Skip to content

Commit db81ea6

Browse files
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`.
1 parent cfde3a3 commit db81ea6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ public void testFTPSetTimeout() {
236236

237237
private static void touch(FileSystem fs, Path filePath)
238238
throws IOException {
239-
touch(fs, filePath, null);
239+
// Create a file with a single byte of data.
240+
touch(fs, filePath, new byte[] {1});
240241
}
241242

242243
private static void touch(FileSystem fs, Path path, byte[] data)
@@ -266,8 +267,9 @@ public void testRenameFileWithFullQualifiedPath() throws Exception {
266267

267268
FileSystem fs = FileSystem.get(configuration);
268269

269-
270-
Path ftpDir = fs.makeQualified(new Path(testDir.toAbsolutePath().toString()));
270+
// All the file operations will be relative to the root directory specified by the testDir
271+
// member variable.
272+
Path ftpDir = fs.makeQualified(new Path("/"));
271273
Path file1 = fs.makeQualified(new Path(ftpDir, "renamefile" + "1"));
272274
Path file2 = fs.makeQualified(new Path(ftpDir, "renamefile" + "2"));
273275
touch(fs, file1);

0 commit comments

Comments
 (0)