HDFS-9855. Modify TestAuditLoggerWithCommands to workaround the absence of HDFS-8332. Contributed by Kuhu Shukla.

This commit is contained in:
Kihwal Lee 2016-02-26 10:02:19 -06:00
parent b0091338f2
commit 03afcdd39d
2 changed files with 10 additions and 6 deletions

View File

@ -1900,6 +1900,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9549. TestCacheDirectives#testExceedsCapacity is flaky (Xiao Chen via HDFS-9549. TestCacheDirectives#testExceedsCapacity is flaky (Xiao Chen via
cmccabe) cmccabe)
HDFS-9855. Modify TestAuditLoggerWithCommands to workaround the absence
of HDFS-8332 (Kuhu Shukla via kihwal)
Release 2.7.3 - UNRELEASED Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -121,7 +121,6 @@ public void testGetContentSummary() throws IOException {
public void testSetQuota() throws Exception { public void testSetQuota() throws Exception {
Path path = new Path("/testdir/testdir1"); Path path = new Path("/testdir/testdir1");
fs.mkdirs(path); fs.mkdirs(path);
fileSys = DFSTestUtil.getFileSystemAs(user1, conf);
try { try {
((DistributedFileSystem)fileSys).setQuota(path, 10l, 10l); ((DistributedFileSystem)fileSys).setQuota(path, 10l, 10l);
fail("The operation should have failed with AccessControlException"); fail("The operation should have failed with AccessControlException");
@ -129,15 +128,17 @@ public void testSetQuota() throws Exception {
} }
String acePattern = String acePattern =
".*allowed=false.*ugi=theDoctor.*cmd=setQuota.*"; ".*allowed=false.*ugi=theDoctor.*cmd=setQuota.*";
int length = verifyAuditLogs(acePattern); verifyAuditLogs(acePattern);
fileSys.close(); String ioePattern =
".*allowed=true.*ugi=" + fs.getFileStatus(path).getOwner().toString() +
".*cmd=delete.*";
fs.delete(path, true);
try { try {
((DistributedFileSystem)fileSys).setQuota(path, 10l, 10l); ((DistributedFileSystem)fs).setQuota(path, 10l, 10l);
fail("The operation should have failed with IOException"); fail("The operation should have failed with IOException");
} catch (IOException ace) { } catch (IOException ace) {
} }
assertTrue("Unexpected log from getContentSummary", verifyAuditLogs(ioePattern);
length == auditlog.getOutput().split("\n").length);
} }
@Test @Test