diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java index 968b1c6da9f..1fd69576e5d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java @@ -223,13 +223,19 @@ public class TestDistributedFileSystem { 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