Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-23695

Fail more gracefully when test class is missing Category

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0, 2.3.0, 2.2.3, 2.1.9
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      When a test class is missing a category, you might see an error such as:

      [ERROR] Test mechanism  Time elapsed: 0.305 s  <<< ERROR!
      java.lang.ArrayIndexOutOfBoundsException: 0[ERROR] Test mechanism  Time elapsed: 0.102 s  <<< ERROR!
      java.lang.ArrayIndexOutOfBoundsException: 0[ERROR] Test mechanism  Time elapsed: 0.103 s  <<< ERROR!
      java.lang.ArrayIndexOutOfBoundsException: 0[ERROR] Test mechanism  Time elapsed: 0.102 s  <<< ERROR!
      java.lang.ArrayIndexOutOfBoundsException: 0[ERROR] Test mechanism  Time elapsed: 0.098 s  <<< ERROR!
      java.lang.ArrayIndexOutOfBoundsException: 0[ERROR] Test mechanism :: 0 

      You have to dig into the dump file to find out the actual error was:

      org.apache.maven.surefire.testset.TestSetFailedException: Test mechanism :: 0
              at org.apache.maven.surefire.common.junit4.JUnit4RunListener.rethrowAnyTestMechanismFailures(JUnit4RunListener.java:192)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
              at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
              at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
              at org.apache.hadoop.hbase.HBaseClassTestRuleChecker.testStarted(HBaseClassTestRuleChecker.java:44)
              at org.junit.runner.notification.RunNotifier$5.notifyListener(RunNotifier.java:156)
              at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
              at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:153)
              at org.apache.maven.surefire.common.junit4.Notifier.fireTestStarted(Notifier.java:100)
              at org.junit.internal.runners.model.EachTestNotifier.fireTestStarted(EachTestNotifier.java:42)
              at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:364)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
              at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
              at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
              at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
              at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
              ... 4 more 

      We can fix this up to get a proper exception thrown.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                elserj Josh Elser
                Reporter:
                elserj Josh Elser
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: