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

Verify IntegrationTests don't rely on Rules outside of JUnit context

    XMLWordPrintableJSON

    Details

    • Hadoop Flags:
      Reviewed

      Description

      2017-11-16 00:43:41,204 INFO  [main] mapreduce.IntegrationTestImportTsv: Running test testGenerateAndLoad.
      Exception in thread "main" java.lang.NullPointerException
        at org.apache.hadoop.hbase.TableName.valueOf(TableName.java:461)
        at org.apache.hadoop.hbase.mapreduce.IntegrationTestImportTsv.testGenerateAndLoad(IntegrationTestImportTsv.java:189)
        at org.apache.hadoop.hbase.mapreduce.IntegrationTestImportTsv.run(IntegrationTestImportTsv.java:229)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.hadoop.hbase.mapreduce.IntegrationTestImportTsv.main(IntegrationTestImportTsv.java:239)
      

      (Potential line-number skew)

        @Test
        public void testGenerateAndLoad() throws Exception {
          LOG.info("Running test testGenerateAndLoad.");
          final TableName table = TableName.valueOf(name.getMethodName());
      

      The JUnit framework sets the test method name inside of the JUnit Rule. When we invoke the test directly (ala hbase org.apache.hadoop.hbase.mapreduce.IntegrationTestImportTsv), this getMethodName() returns null and we get the above stacktrace.

      Should make a pass over the ITs with main methods and Rule's to make sure we don't have this lurking. Another alternative is to just remove the main methods and just force use of IntegrationTestsDriver instead.

        Attachments

        1. HBASE-19310.001.branch-2.patch
          2 kB
          Josh Elser
        2. HBASE-19310.002.branch-2.patch
          2 kB
          Josh Elser

          Activity

            People

            • Assignee:
              elserj Josh Elser
              Reporter:
              romil.choksi Romil Choksi
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: