Browse Source

HADOOP-19555. Fix testRenameFileWithFullQualifiedPath on Windows (#7654)

* This PR fixes the unit test failure caused by
  incorrectly using the absolute path for FS
  operations on the `FTPFileSystem`.
Gautham B A 3 days ago
parent
commit
db81ea603c

+ 5 - 3
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java

@@ -236,7 +236,8 @@ public class TestFTPFileSystem {
 
 
   private static void touch(FileSystem fs, Path filePath)
   private static void touch(FileSystem fs, Path filePath)
           throws IOException {
           throws IOException {
-    touch(fs, filePath, null);
+    // Create a file with a single byte of data.
+    touch(fs, filePath, new byte[] {1});
   }
   }
 
 
   private static void touch(FileSystem fs, Path path, byte[] data)
   private static void touch(FileSystem fs, Path path, byte[] data)
@@ -266,8 +267,9 @@ public class TestFTPFileSystem {
 
 
     FileSystem fs = FileSystem.get(configuration);
     FileSystem fs = FileSystem.get(configuration);
 
 
-
-    Path ftpDir = fs.makeQualified(new Path(testDir.toAbsolutePath().toString()));
+    // All the file operations will be relative to the root directory specified by the testDir
+    // member variable.
+    Path ftpDir = fs.makeQualified(new Path("/"));
     Path file1 = fs.makeQualified(new Path(ftpDir, "renamefile" + "1"));
     Path file1 = fs.makeQualified(new Path(ftpDir, "renamefile" + "1"));
     Path file2 = fs.makeQualified(new Path(ftpDir, "renamefile" + "2"));
     Path file2 = fs.makeQualified(new Path(ftpDir, "renamefile" + "2"));
     touch(fs, file1);
     touch(fs, file1);