소스 검색

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 2 달 전
부모
커밋
db81ea603c
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java

+ 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)
           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)
@@ -266,8 +267,9 @@ public class TestFTPFileSystem {
 
     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 file2 = fs.makeQualified(new Path(ftpDir, "renamefile" + "2"));
     touch(fs, file1);