|
@@ -51,6 +51,7 @@ import org.junit.Before;
|
|
|
import org.junit.Test;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
+import static org.junit.Assert.assertFalse;
|
|
|
import static org.junit.Assert.fail;
|
|
|
import org.mockito.Mockito;
|
|
|
|
|
@@ -1205,6 +1206,18 @@ public class TestAuditLoggerWithCommands {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testDeleteRoot() throws Exception {
|
|
|
+ Path srcDir = new Path("/");
|
|
|
+ fileSys = DFSTestUtil.getFileSystemAs(user1, conf);
|
|
|
+ boolean result = fileSys.delete(srcDir, true);
|
|
|
+ fileSys.close();
|
|
|
+ assertFalse(result);
|
|
|
+ String aceDeletePattern =
|
|
|
+ ".*allowed=false.*ugi=theDoctor.*cmd=delete.*";
|
|
|
+ verifyAuditLogs(aceDeletePattern);
|
|
|
+ }
|
|
|
+
|
|
|
private void verifyAuditRestoreFailedStorageACE(
|
|
|
FSNamesystem fsNamesystem, String arg) throws IOException {
|
|
|
String operationName = fsNamesystem.getFailedStorageCommand(arg);
|