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

TestBasicDiskValidator should not write data to /tmp

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.9.0
    • 2.9.0, 3.0.0-alpha1
    • None
    • 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

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            yufeigu Yufei Gu Assign to me
            eddyxu Lei (Eddy) Xu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment