|
@@ -64,6 +64,7 @@ import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.TestFsck;
|
|
|
import org.apache.hadoop.hdfs.tools.GetGroups;
|
|
|
import org.apache.hadoop.ipc.ObserverRetryOnActiveException;
|
|
|
+import org.apache.hadoop.test.LambdaTestUtils;
|
|
|
import org.apache.hadoop.util.Time;
|
|
|
import org.apache.hadoop.util.concurrent.HadoopExecutors;
|
|
|
import org.junit.After;
|
|
@@ -608,6 +609,17 @@ public class TestObserverNode {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testGetListingForDeletedDir() throws Exception {
|
|
|
+ Path path = new Path("/dir1/dir2/testFile");
|
|
|
+ dfs.create(path).close();
|
|
|
+
|
|
|
+ assertTrue(dfs.delete(new Path("/dir1/dir2"), true));
|
|
|
+
|
|
|
+ LambdaTestUtils.intercept(FileNotFoundException.class,
|
|
|
+ () -> dfs.listLocatedStatus(new Path("/dir1/dir2")));
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testSimpleReadEmptyDirOrFile() throws IOException {
|
|
|
// read empty dir
|