Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12472

Make GenericTestUtils.assertExceptionContains robust

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha1
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: test
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      GenericTestUtils.assertExceptionContains calls Exception.getMessage(), followed by msg.contains().

      This will NPE for an exception with a null message, such as NPE.

      1. it should call toString()
      2. and do an assertNotNull on the result in case some subclass does something very bad
      3. and for safety, check the asser

        Issue Links

          Activity

          Hide
          stevel@apache.org Steve Loughran added a comment -

          Patch 001

          1. adds the robustness checks
          2. all asserts raised also include the failing exception as a nested value.
          3. and there are checks for all the behaviours
          Show
          stevel@apache.org Steve Loughran added a comment - Patch 001 adds the robustness checks all asserts raised also include the failing exception as a nested value. and there are checks for all the behaviours
          Hide
          hadoopqa Hadoop QA added a comment -



          -1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 9m 27s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 tests included 0m 0s The patch appears to include 2 new or modified test files.
          +1 javac 7m 49s There were no new javac warning messages.
          -1 release audit 0m 18s The applied patch generated 1 release audit warnings.
          +1 checkstyle 1m 7s There were no new checkstyle issues.
          -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.
          +1 install 1m 29s mvn install still works.
          +1 eclipse:eclipse 0m 34s The patch built with eclipse:eclipse.
          +1 findbugs 1m 56s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
          -1 common tests 7m 54s Tests failed in hadoop-common.
              30m 40s  



          Reason Tests
          Failed unit tests hadoop.fs.TestLocalFsFCStatistics



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12765985/HADOOP-12472-001.patch
          Optional Tests javac unit findbugs checkstyle
          git revision trunk / 7e2c971
          Release Audit https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/patchReleaseAuditProblems.txt
          whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/whitespace.txt
          hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/testrun_hadoop-common.txt
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/testReport/
          Java 1.7.0_55
          uname Linux asf906.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 9m 27s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 tests included 0m 0s The patch appears to include 2 new or modified test files. +1 javac 7m 49s There were no new javac warning messages. -1 release audit 0m 18s The applied patch generated 1 release audit warnings. +1 checkstyle 1m 7s There were no new checkstyle issues. -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix. +1 install 1m 29s mvn install still works. +1 eclipse:eclipse 0m 34s The patch built with eclipse:eclipse. +1 findbugs 1m 56s The patch does not introduce any new Findbugs (version 3.0.0) warnings. -1 common tests 7m 54s Tests failed in hadoop-common.     30m 40s   Reason Tests Failed unit tests hadoop.fs.TestLocalFsFCStatistics Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12765985/HADOOP-12472-001.patch Optional Tests javac unit findbugs checkstyle git revision trunk / 7e2c971 Release Audit https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/patchReleaseAuditProblems.txt whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/whitespace.txt hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/artifact/patchprocess/testrun_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/testReport/ Java 1.7.0_55 uname Linux asf906.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7794/console This message was automatically generated.
          Hide
          stevel@apache.org Steve Loughran added a comment -

          test failure is spurious

          Show
          stevel@apache.org Steve Loughran added a comment - test failure is spurious
          Hide
          andrew.wang Andrew Wang added a comment -

          We could make the static strings package-private and final right? Otherwise LGTM, +1 pending that.

          Show
          andrew.wang Andrew Wang added a comment - We could make the static strings package-private and final right? Otherwise LGTM, +1 pending that.
          Hide
          jingzhao Jing Zhao added a comment -

          +1. I've committed this to trunk and branch-2. Thanks for the contribution, Steve Loughran!

          Show
          jingzhao Jing Zhao added a comment - +1. I've committed this to trunk and branch-2. Thanks for the contribution, Steve Loughran !
          Hide
          jingzhao Jing Zhao added a comment -

          oops, have not seen this comment before committing the patch. Maybe we can do this as a follow on?

          Show
          jingzhao Jing Zhao added a comment - oops, have not seen this comment before committing the patch. Maybe we can do this as a follow on?
          Hide
          liuml07 Mingliang Liu added a comment -

          Thanks Andrew Wang and Jing Zhao for pointing this out.
          Yes it makes sense to make them package-private as they're for test purpose. I filed HADOOP-12514 to track this.

          Show
          liuml07 Mingliang Liu added a comment - Thanks Andrew Wang and Jing Zhao for pointing this out. Yes it makes sense to make them package-private as they're for test purpose. I filed HADOOP-12514 to track this.
          Hide
          andrew.wang Andrew Wang added a comment -

          Yep sounds good, let's take it to the follow-on JIRA.

          Show
          andrew.wang Andrew Wang added a comment - Yep sounds good, let's take it to the follow-on JIRA.
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-trunk-Commit #8710 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8710/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8710 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8710/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk #1323 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1323/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #1323 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1323/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #599 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/599/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #599 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/599/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk #2477 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2477/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2477 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2477/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk #2530 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2530/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          • hadoop-common-project/hadoop-common/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2530 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2530/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java hadoop-common-project/hadoop-common/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #540 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/540/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #540 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/540/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #588 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/588/)
          HADOOP-12472. Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa)

          • hadoop-common-project/hadoop-common/CHANGES.txt
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #588 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/588/ ) HADOOP-12472 . Make GenericTestUtils.assertExceptionContains robust. (jing9: rev a01a209fbed33b2ecaf9e736631e64abefae01aa) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/TestGenericTestUtils.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java

            People

            • Assignee:
              stevel@apache.org Steve Loughran
              Reporter:
              stevel@apache.org Steve Loughran
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development