Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-11135

The tests in TestBalancer run fails due to NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0, 3.0.0-alpha2
    • test
    • None
    • Reviewed

    Description

      I am making test for HDFS-11051, I found a serious issue: All the tests in TestBalancer fails except TestBalancer#testBalancerWithKeytabs. I saw there was NPE threw in the method TestBalancer#destroy. The stack infos:

      java.lang.NullPointerException
      	at org.apache.hadoop.fs.FileUtil.fullyDeleteContents(FileUtil.java:242)
      	at org.apache.hadoop.fs.FileUtil.fullyDelete(FileUtil.java:164)
      	at org.apache.hadoop.fs.FileUtil.fullyDelete(FileUtil.java:135)
      	at org.apache.hadoop.hdfs.server.balancer.TestBalancer.destroy(TestBalancer.java:274)
      

      The related codes:

        @AfterClass
        public static void destroy() throws Exception {
          if (kdc != null) {
            kdc.stop();
          }
          FileUtil.fullyDelete(baseDir);
            KeyStoreTestUtil.cleanupSSLConfig(keystoresDir, sslConfDir);
        }
      

      It seems that the deleted dir baseDir is only used in TestBalancer#testBalancerWithKeytabs, but here we don't do a check and then it throws the NPE. Finally cause the other tests fails. Since it will run the test TestBalancer#testBalancerWithKeytabs and initialize the dir if we do the whole test TesrBalancer, and it will runs good. However, it will fails if we want to run a single test in TestBalancer.

      Attachments

        1. HDFS-11135.001.patch
          0.9 kB
          Yiqun Lin

        Issue Links

          Activity

            People

              linyiqun Yiqun Lin
              linyiqun Yiqun Lin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: