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.

        Attachments

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

          Issue Links

            Activity

              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: