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

          Konstantin Boudnik created issue -
          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
          Konstantin Boudnik made changes -
          Field Original Value New Value
          Attachment HDFS-549.patch [ 12416808 ]
          Konstantin Boudnik made changes -
          Link This issue relates to HDFS-475 [ HDFS-475 ]
          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
          Konstantin Boudnik made changes -
          Attachment HDFS-549.patch [ 12416814 ]
          Konstantin Boudnik made changes -
          Assignee Konstantin Boudnik [ cos ]
          Hide
          Tsz Wo Nicholas Sze added a comment -

          +1 patch looks good.

          Show
          Tsz Wo Nicholas Sze added a comment - +1 patch looks good.
          Tsz Wo Nicholas Sze made changes -
          Hadoop Flags [Reviewed]
          Fix Version/s 0.21.0 [ 12314046 ]
          Affects Version/s 0.21.0 [ 12314046 ]
          Component/s build [ 12312925 ]
          Konstantin Boudnik made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          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!
          Tsz Wo Nicholas Sze made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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.
          Tsz Wo Nicholas Sze made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Tsz Wo Nicholas Sze made changes -
          Hadoop Flags [Reviewed]
          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
          Konstantin Boudnik made changes -
          Attachment HDFS-549.patch [ 12418327 ]
          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!
          Tsz Wo Nicholas Sze made changes -
          Hadoop Flags [Reviewed]
          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!
          Tsz Wo Nicholas Sze made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Resolved [ 5 ]
          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
          Tom White made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development