Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-549

Allow non fault-inject specific tests execution with an explicit -Dtestcase=... setting

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.21.0
    • Fix Version/s: 0.21.0
    • Component/s: build
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      It is currently impossible to run non fault-injection tests with fault-injected build. E.g.

        ant run-test-hdfs-fault-inject -Dtestcase=TestFileCreation
      

      because macro-test-runner does look for a specified test case only under src/test/aop folder if a fault injection tests are ran. This render the use of non fault injection tests impossible in the FI environment.

      1. HDFS-549.patch
        0.5 kB
        Konstantin Boudnik
      2. HDFS-549.patch
        0.8 kB
        Konstantin Boudnik
      3. HDFS-549.patch
        2 kB
        Konstantin Boudnik

        Issue Links

          Activity

          Hide
          Konstantin Boudnik added a comment -

          This functionality is important for some issues verification like in this case HDFS-448

          Show
          Konstantin Boudnik added a comment - This functionality is important for some issues verification like in this case HDFS-448
          Hide
          Konstantin Boudnik added a comment -

          The same is done for hdfs-with-mr tests

          Show
          Konstantin Boudnik added a comment - The same is done for hdfs-with-mr tests
          Hide
          Tsz Wo Nicholas Sze added a comment -

          +1 patch looks good.

          Show
          Tsz Wo Nicholas Sze added a comment - +1 patch looks good.
          Hide
          Konstantin Boudnik added a comment -

          Running a non fault-injected test after the patch is put in place:

          % ant run-test-hdfs-fault-inject -Dtestcase=TestFileAppend
          run-test-hdfs:
          ...
              [junit] Running org.apache.hadoop.hdfs.TestFileAppend
              [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 20.325 sec
          
          checkfailure:
          
          BUILD SUCCESSFUL
          

          Without the patch the test targets were running nothing in the similar case.

          Show
          Konstantin Boudnik added a comment - Running a non fault-injected test after the patch is put in place: % ant run-test-hdfs-fault-inject -Dtestcase=TestFileAppend run-test-hdfs: ... [junit] Running org.apache.hadoop.hdfs.TestFileAppend [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 20.325 sec checkfailure: BUILD SUCCESSFUL Without the patch the test targets were running nothing in the similar case.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I have committed this. Thanks, Cos!

          Show
          Tsz Wo Nicholas Sze added a comment - I have committed this. Thanks, Cos!
          Hide
          Tsz Wo Nicholas Sze added a comment -

          Hi Cos,

          After the patch, there is a side effect that a unit test will be executed twice, normal and fi, when with "ant test -Dtestcase=...", e.g.

          ant test -Dtestcase=TestSimulatedFSDataset
          

          Then, the build fails for tests like TestSimulatedFSDataset since the execution with fi fails. Could you check it?

          Show
          Tsz Wo Nicholas Sze added a comment - Hi Cos, After the patch, there is a side effect that a unit test will be executed twice, normal and fi, when with "ant test -Dtestcase=...", e.g. ant test -Dtestcase=TestSimulatedFSDataset Then, the build fails for tests like TestSimulatedFSDataset since the execution with fi fails. Could you check it?
          Hide
          Konstantin Boudnik added a comment -

          I think it isn't the patch's side effect. This is caused by the fact that test target run both - normal and fault-injected tests. Thus, the test in question will be executed twice for sure.

          In order to avoid it you need to run

          ant run-test-hdfs -Dtestcase=TestSimulatedFSDataset
          

          instead

          Show
          Konstantin Boudnik added a comment - I think it isn't the patch's side effect. This is caused by the fact that test target run both - normal and fault-injected tests. Thus, the test in question will be executed twice for sure. In order to avoid it you need to run ant run-test-hdfs -Dtestcase=TestSimulatedFSDataset instead
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I think we better not to change the behavior of "ant test -Dtestcase=..." because there are many contributors using it. Also, it does not make sense to run tests with both normal and fi executions for most of the existing tests. They will just fail on one of the executions.

          Show
          Tsz Wo Nicholas Sze added a comment - I think we better not to change the behavior of "ant test -Dtestcase=..." because there are many contributors using it. Also, it does not make sense to run tests with both normal and fi executions for most of the existing tests. They will just fail on one of the executions.
          Hide
          Konstantin Boudnik added a comment -

          I see your point, Nicholas. However, the use case for this JIRA was to be able to run a normal test in FI environment when such situation reveals bugs in the code. Well, the patch is easy to rollback if this would be an intention.

          Show
          Konstantin Boudnik added a comment - I see your point, Nicholas. However, the use case for this JIRA was to be able to run a normal test in FI environment when such situation reveals bugs in the code. Well, the patch is easy to rollback if this would be an intention.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I will revert the patch since there is an incompatible problem, i.e. "ant test -Dtestcase=..." fails for most of the tests.

          Show
          Tsz Wo Nicholas Sze added a comment - I will revert the patch since there is an incompatible problem, i.e. "ant test -Dtestcase=..." fails for most of the tests.
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk-Commit #6 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/6/)
          Revert .

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #6 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/6/ ) Revert .
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk #65 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk/65/)
          Revert .

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk #65 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk/65/ ) Revert .
          Hide
          Konstantin Boudnik added a comment -

          Thanks for getting this out, Nicholas.

          I still believe that we need this functionality, however, it has to be done differently. One way is to make the logic around FI related use cases more complex in order to prevent unintentional execution of non-FI tests in FI environment. Another possibility is to separate FI and non-FI test targets from both test and test-core. Something to think about...

          Show
          Konstantin Boudnik added a comment - Thanks for getting this out, Nicholas. I still believe that we need this functionality, however, it has to be done differently. One way is to make the logic around FI related use cases more complex in order to prevent unintentional execution of non-FI tests in FI environment. Another possibility is to separate FI and non-FI test targets from both test and test-core . Something to think about...
          Hide
          Konstantin Boudnik added a comment -

          This new patch introduces new target run-with-fault-inject-testcaseonly which isn't visible in project's help and allow an execution of non-FI tests in FI-enable environment.

          Upon execution of

            % ant test-core -Dtestcase=<testname>
          

          only non-FI or FI related test case will be executed.

          Also, as the matter of precaution if new target is executed without a test case specification the build is aborted immediately with the

           
          BUILD FAILED
          /.../work/Hdfs.inj/build.xml:365: Can't run this target without -Dtestcase setting!
          

          message

          Show
          Konstantin Boudnik added a comment - This new patch introduces new target run-with-fault-inject-testcaseonly which isn't visible in project's help and allow an execution of non-FI tests in FI-enable environment. Upon execution of % ant test-core -Dtestcase=<testname> only non-FI or FI related test case will be executed. Also, as the matter of precaution if new target is executed without a test case specification the build is aborted immediately with the BUILD FAILED /.../work/Hdfs.inj/build.xml:365: Can't run this target without -Dtestcase setting! message
          Hide
          Tsz Wo Nicholas Sze added a comment -

          +1 the patch is perfect!

          Show
          Tsz Wo Nicholas Sze added a comment - +1 the patch is perfect!
          Hide
          Tsz Wo Nicholas Sze added a comment -

          Tested it with the followings:

          ant run-with-fault-inject-testcaseonly
          ant run-with-fault-inject-testcaseonly -Dtestcase=TestSimulatedFSDataset
          ant test -Dtestcase=TestSimulatedFSDataset
          

          It worked fine.

          I have committed this. Thanks, Cos!

          Show
          Tsz Wo Nicholas Sze added a comment - Tested it with the followings: ant run-with-fault-inject-testcaseonly ant run-with-fault-inject-testcaseonly -Dtestcase=TestSimulatedFSDataset ant test -Dtestcase=TestSimulatedFSDataset It worked fine. I have committed this. Thanks, Cos!
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk-Commit #12 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/12/)
          . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #12 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/12/ ) . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik
          Hide
          Hudson added a comment -

          Integrated in Hdfs-Patch-h5.grid.sp2.yahoo.net #8 (See http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/8/)
          . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik

          Show
          Hudson added a comment - Integrated in Hdfs-Patch-h5.grid.sp2.yahoo.net #8 (See http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/8/ ) . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk #71 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk/71/)
          . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk #71 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Hdfs-trunk/71/ ) . Add a new target, run-with-fault-inject-testcaseonly, which allows an execution of non-FI tests in FI-enable environment. Contributed by Konstantin Boudnik

            People

            • Assignee:
              Konstantin Boudnik
              Reporter:
              Konstantin Boudnik
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development