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

TestBasicDiskValidator should not write data to /tmp

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.0
    • Fix Version/s: 2.9.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None

      Description

      In TestBasicDiskValidator, the following code is confusing

         File localDir = File.createTempFile("test", "tmp");
      try {
         if (isDir) {
             // reuse the file path generated by File#createTempFile to create a dir
            localDir.delete();
             localDir.mkdir();
      }
      

      Btw, as suggested in https://wiki.apache.org/hadoop/CodeReviewChecklist, unit test should not write data into /tmp:

      * unit tests do not write any temporary files to /tmp (instead, the tests should write to the location specified by the test.build.data system property)

      Finally, should use Files in these file creation / deletion, so that any error can be thrown as IOE.

      1. HADOOP-13380.001.patch
        4 kB
        Yufei Gu
      2. HADOOP-13380.002.patch
        4 kB
        Yufei Gu

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-trunk-Commit #10238 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10238/)
          HADOOP-13380. TestBasicDiskValidator should not write data to /tmp (lei: rev 6418edd6feeafc0204536e1860942eeb1cb1a9ce)

          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java
          • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-trunk-Commit #10238 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10238/ ) HADOOP-13380 . TestBasicDiskValidator should not write data to /tmp (lei: rev 6418edd6feeafc0204536e1860942eeb1cb1a9ce) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDiskChecker.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestBasicDiskValidator.java
          Hide
          yufeigu Yufei Gu added a comment -

          Thanks a lot for the review and commit, Lei (Eddy) Xu!

          Show
          yufeigu Yufei Gu added a comment - Thanks a lot for the review and commit, Lei (Eddy) Xu !
          Hide
          eddyxu Lei (Eddy) Xu added a comment -

          Thanks for the work, Yufei Gu. +1. Committed to trunk and branch-2.

          Show
          eddyxu Lei (Eddy) Xu added a comment - Thanks for the work, Yufei Gu . +1. Committed to trunk and branch-2.
          Hide
          hadoopqa Hadoop QA added a comment -
          +1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 9s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
          +1 mvninstall 6m 38s trunk passed
          +1 compile 6m 45s trunk passed
          +1 checkstyle 0m 22s trunk passed
          +1 mvnsite 0m 54s trunk passed
          +1 mvneclipse 0m 12s trunk passed
          +1 findbugs 1m 18s trunk passed
          +1 javadoc 0m 44s trunk passed
          +1 mvninstall 0m 37s the patch passed
          +1 compile 6m 43s the patch passed
          +1 javac 6m 43s the patch passed
          +1 checkstyle 0m 22s hadoop-common-project/hadoop-common: The patch generated 0 new + 25 unchanged - 1 fixed = 25 total (was 26)
          +1 mvnsite 0m 51s the patch passed
          +1 mvneclipse 0m 12s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 1m 26s the patch passed
          +1 javadoc 0m 45s the patch passed
          +1 unit 8m 3s hadoop-common in the patch passed.
          +1 asflicense 0m 21s The patch does not generate ASF License warnings.
          37m 46s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12820729/HADOOP-13380.002.patch
          JIRA Issue HADOOP-13380
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux e1a358837b01 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
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 7f3c306
          Default Java 1.8.0_101
          findbugs v3.0.0
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10105/testReport/
          modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10105/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 9s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. +1 mvninstall 6m 38s trunk passed +1 compile 6m 45s trunk passed +1 checkstyle 0m 22s trunk passed +1 mvnsite 0m 54s trunk passed +1 mvneclipse 0m 12s trunk passed +1 findbugs 1m 18s trunk passed +1 javadoc 0m 44s trunk passed +1 mvninstall 0m 37s the patch passed +1 compile 6m 43s the patch passed +1 javac 6m 43s the patch passed +1 checkstyle 0m 22s hadoop-common-project/hadoop-common: The patch generated 0 new + 25 unchanged - 1 fixed = 25 total (was 26) +1 mvnsite 0m 51s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 26s the patch passed +1 javadoc 0m 45s the patch passed +1 unit 8m 3s hadoop-common in the patch passed. +1 asflicense 0m 21s The patch does not generate ASF License warnings. 37m 46s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12820729/HADOOP-13380.002.patch JIRA Issue HADOOP-13380 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux e1a358837b01 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 Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 7f3c306 Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10105/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10105/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 8s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
          +1 mvninstall 8m 7s trunk passed
          +1 compile 8m 48s trunk passed
          +1 checkstyle 0m 27s trunk passed
          +1 mvnsite 1m 7s trunk passed
          +1 mvneclipse 0m 15s trunk passed
          +1 findbugs 1m 37s trunk passed
          +1 javadoc 0m 50s trunk passed
          +1 mvninstall 0m 40s the patch passed
          +1 compile 8m 27s the patch passed
          +1 javac 8m 27s the patch passed
          +1 checkstyle 0m 24s hadoop-common-project/hadoop-common: The patch generated 0 new + 25 unchanged - 1 fixed = 25 total (was 26)
          +1 mvnsite 0m 55s the patch passed
          +1 mvneclipse 0m 13s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 1m 34s the patch passed
          +1 javadoc 0m 47s the patch passed
          -1 unit 8m 42s hadoop-common in the patch failed.
          +1 asflicense 0m 24s The patch does not generate ASF License warnings.
          44m 50s



          Reason Tests
          Failed junit tests hadoop.metrics2.impl.TestGangliaMetrics
            hadoop.ha.TestZKFailoverController



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12820595/HADOOP-13380.002.patch
          JIRA Issue HADOOP-13380
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux fd52f81ae1e0 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
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / b43de80
          Default Java 1.8.0_101
          findbugs v3.0.0
          unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/testReport/
          modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 8s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. +1 mvninstall 8m 7s trunk passed +1 compile 8m 48s trunk passed +1 checkstyle 0m 27s trunk passed +1 mvnsite 1m 7s trunk passed +1 mvneclipse 0m 15s trunk passed +1 findbugs 1m 37s trunk passed +1 javadoc 0m 50s trunk passed +1 mvninstall 0m 40s the patch passed +1 compile 8m 27s the patch passed +1 javac 8m 27s the patch passed +1 checkstyle 0m 24s hadoop-common-project/hadoop-common: The patch generated 0 new + 25 unchanged - 1 fixed = 25 total (was 26) +1 mvnsite 0m 55s the patch passed +1 mvneclipse 0m 13s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 34s the patch passed +1 javadoc 0m 47s the patch passed -1 unit 8m 42s hadoop-common in the patch failed. +1 asflicense 0m 24s The patch does not generate ASF License warnings. 44m 50s Reason Tests Failed junit tests hadoop.metrics2.impl.TestGangliaMetrics   hadoop.ha.TestZKFailoverController Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12820595/HADOOP-13380.002.patch JIRA Issue HADOOP-13380 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux fd52f81ae1e0 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 Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / b43de80 Default Java 1.8.0_101 findbugs v3.0.0 unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10098/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          yufeigu Yufei Gu added a comment -

          Thanks Lei (Eddy) Xu for the review. I uploaded the patch 002 for your comment.

          Show
          yufeigu Yufei Gu added a comment - Thanks Lei (Eddy) Xu for the review. I uploaded the patch 002 for your comment.
          Hide
          hadoopqa Hadoop QA added a comment -
          +1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 8s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
          +1 mvninstall 6m 32s trunk passed
          +1 compile 6m 47s trunk passed
          +1 checkstyle 0m 22s trunk passed
          +1 mvnsite 0m 54s trunk passed
          +1 mvneclipse 0m 12s trunk passed
          +1 findbugs 1m 17s trunk passed
          +1 javadoc 0m 44s trunk passed
          +1 mvninstall 0m 37s the patch passed
          +1 compile 6m 40s the patch passed
          +1 javac 6m 40s the patch passed
          +1 checkstyle 0m 22s the patch passed
          +1 mvnsite 0m 51s the patch passed
          +1 mvneclipse 0m 13s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 1m 25s the patch passed
          +1 javadoc 0m 44s the patch passed
          +1 unit 8m 4s hadoop-common in the patch passed.
          +1 asflicense 0m 20s The patch does not generate ASF License warnings.
          37m 38s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12819427/HADOOP-13380.001.patch
          JIRA Issue HADOOP-13380
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux c300efce7356 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
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 54fe17a
          Default Java 1.8.0_101
          findbugs v3.0.0
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10096/testReport/
          modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10096/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 8s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. +1 mvninstall 6m 32s trunk passed +1 compile 6m 47s trunk passed +1 checkstyle 0m 22s trunk passed +1 mvnsite 0m 54s trunk passed +1 mvneclipse 0m 12s trunk passed +1 findbugs 1m 17s trunk passed +1 javadoc 0m 44s trunk passed +1 mvninstall 0m 37s the patch passed +1 compile 6m 40s the patch passed +1 javac 6m 40s the patch passed +1 checkstyle 0m 22s the patch passed +1 mvnsite 0m 51s the patch passed +1 mvneclipse 0m 13s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 25s the patch passed +1 javadoc 0m 44s the patch passed +1 unit 8m 4s hadoop-common in the patch passed. +1 asflicense 0m 20s The patch does not generate ASF License warnings. 37m 38s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12819427/HADOOP-13380.001.patch JIRA Issue HADOOP-13380 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux c300efce7356 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 Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 54fe17a Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10096/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10096/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          eddyxu Lei (Eddy) Xu added a comment -

          Yufei Gu

          Thanks for the solution. Looks good overall.

          • You should use Files.createTempDirectory instead of creating you own one.
          Show
          eddyxu Lei (Eddy) Xu added a comment - Yufei Gu Thanks for the solution. Looks good overall. You should use Files.createTempDirectory instead of creating you own one.
          Hide
          yufeigu Yufei Gu added a comment -

          AFAIK, TestDiskChecker has the same problem, we should solve it as well. This issue may exist in some other unit tests. Please report it if you find any.

          Show
          yufeigu Yufei Gu added a comment - AFAIK, TestDiskChecker has the same problem, we should solve it as well. This issue may exist in some other unit tests. Please report it if you find any.

            People

            • Assignee:
              yufeigu Yufei Gu
              Reporter:
              eddyxu Lei (Eddy) Xu
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development