HADOOP-17036. TestFTPFileSystem failing as ftp server dir already exists.
Contributed by Mikhail Pryakhin.
(cherry picked from commit 017d24e970
)
This commit is contained in:
parent
df50e210dd
commit
0f12f3e125
|
@ -55,13 +55,16 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class TestFTPFileSystem {
|
public class TestFTPFileSystem {
|
||||||
|
|
||||||
private FtpTestServer server;
|
private FtpTestServer server;
|
||||||
|
private java.nio.file.Path testDir;
|
||||||
@Rule
|
@Rule
|
||||||
public Timeout testTimeout = new Timeout(180000);
|
public Timeout testTimeout = new Timeout(180000);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -69,7 +72,7 @@ public class TestFTPFileSystem {
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
server.stop();
|
server.stop();
|
||||||
Files.walk(server.getFtpRoot())
|
Files.walk(testDir)
|
||||||
.sorted(Comparator.reverseOrder())
|
.sorted(Comparator.reverseOrder())
|
||||||
.map(java.nio.file.Path::toFile)
|
.map(java.nio.file.Path::toFile)
|
||||||
.forEach(File::delete);
|
.forEach(File::delete);
|
||||||
|
|
Loading…
Reference in New Issue