From 017d24e9703e9447f88ba94df3a8aa0800de770b Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 14 May 2020 20:28:00 +0300 Subject: [PATCH] HADOOP-17036. TestFTPFileSystem failing as ftp server dir already exists. Contributed by Mikhail Pryakhin. --- .../java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java index 02d5a4852b..d3750e6446 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java @@ -55,13 +55,16 @@ public class TestFTPFileSystem { private FtpTestServer server; - + private java.nio.file.Path testDir; @Rule public Timeout testTimeout = new Timeout(180000); @Before public void setUp() throws Exception { - server = new FtpTestServer(GenericTestUtils.getTestDir().toPath()).start(); + testDir = Files.createTempDirectory( + GenericTestUtils.getTestDir().toPath(), getClass().getName() + ); + server = new FtpTestServer(testDir).start(); } @After @@ -69,7 +72,7 @@ public void setUp() throws Exception { public void tearDown() throws Exception { if (server != null) { server.stop(); - Files.walk(server.getFtpRoot()) + Files.walk(testDir) .sorted(Comparator.reverseOrder()) .map(java.nio.file.Path::toFile) .forEach(File::delete);