HDFS-10415. TestDistributedFileSystem#MyDistributedFileSystem attempts to set up statistics before initialize() is called (Mingliang Liu via cmccabe)
(cherry picked from commit 14907d9b8cf5ad7a8241aa66db79cc8e79767cbe)
This commit is contained in:
parent
a8941d7790
commit
0d6a65a40a
@ -223,13 +223,19 @@ public void testDFSCloseOrdering() throws Exception {
|
||||
|
||||
private static class MyDistributedFileSystem extends DistributedFileSystem {
|
||||
MyDistributedFileSystem() {
|
||||
statistics = new FileSystem.Statistics("myhdfs"); // can't mock finals
|
||||
dfs = mock(DFSClient.class);
|
||||
}
|
||||
@Override
|
||||
public boolean exists(Path p) {
|
||||
return true; // trick out deleteOnExit
|
||||
}
|
||||
// Symlink resolution doesn't work with a mock, since it doesn't
|
||||
// have a valid Configuration to resolve paths to the right FileSystem.
|
||||
// Just call the DFSClient directly to register the delete
|
||||
@Override
|
||||
public boolean delete(Path f, final boolean recursive) throws IOException {
|
||||
return dfs.delete(f.toUri().getPath(), recursive);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user