HDFS-15600 Fix TestRouterQuota#testStorageTypeQuota (#2347)

This commit is contained in:
huangtianhua 2020-09-30 10:00:55 +08:00 committed by GitHub
parent a7a1f1541a
commit a89ca56a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -414,13 +414,13 @@ public void testStorageTypeQuota() throws Exception {
QuotaUsage usage = client.getQuotaUsage("/type0"); QuotaUsage usage = client.getQuotaUsage("/type0");
assertEquals(HdfsConstants.QUOTA_RESET, usage.getQuota()); assertEquals(HdfsConstants.QUOTA_RESET, usage.getQuota());
assertEquals(HdfsConstants.QUOTA_RESET, usage.getSpaceQuota()); assertEquals(HdfsConstants.QUOTA_RESET, usage.getSpaceQuota());
verifyTypeQuotaAndConsume(new long[] {-1, -1, ssQuota * 2, -1, -1}, null, verifyTypeQuotaAndConsume(new long[] {-1, -1, -1, ssQuota * 2, -1, -1}, null,
usage); usage);
// Verify /type1 quota on NN1. // Verify /type1 quota on NN1.
usage = client.getQuotaUsage("/type1"); usage = client.getQuotaUsage("/type1");
assertEquals(HdfsConstants.QUOTA_RESET, usage.getQuota()); assertEquals(HdfsConstants.QUOTA_RESET, usage.getQuota());
assertEquals(HdfsConstants.QUOTA_RESET, usage.getSpaceQuota()); assertEquals(HdfsConstants.QUOTA_RESET, usage.getSpaceQuota());
verifyTypeQuotaAndConsume(new long[] {-1, -1, ssQuota, -1, -1}, null, verifyTypeQuotaAndConsume(new long[] {-1, -1, -1, ssQuota, -1, -1}, null,
usage); usage);
FileSystem routerFs = routerContext.getFileSystem(); FileSystem routerFs = routerContext.getFileSystem();
@ -431,15 +431,15 @@ public void testStorageTypeQuota() throws Exception {
assertEquals(2, u1.getFileAndDirectoryCount()); assertEquals(2, u1.getFileAndDirectoryCount());
assertEquals(HdfsConstants.QUOTA_RESET, u1.getSpaceQuota()); assertEquals(HdfsConstants.QUOTA_RESET, u1.getSpaceQuota());
assertEquals(fileSize * 3, u1.getSpaceConsumed()); assertEquals(fileSize * 3, u1.getSpaceConsumed());
verifyTypeQuotaAndConsume(new long[] {-1, -1, ssQuota, -1, -1}, verifyTypeQuotaAndConsume(new long[] {-1, -1, -1, ssQuota, -1, -1},
new long[] {0, 0, fileSize * 3, 0, 0}, u1); new long[] {0, 0, 0, fileSize * 3, 0, 0}, u1);
// Verify /type0 storage type quota usage on Router. // Verify /type0 storage type quota usage on Router.
assertEquals(HdfsConstants.QUOTA_RESET, u0.getQuota()); assertEquals(HdfsConstants.QUOTA_RESET, u0.getQuota());
assertEquals(4, u0.getFileAndDirectoryCount()); assertEquals(4, u0.getFileAndDirectoryCount());
assertEquals(HdfsConstants.QUOTA_RESET, u0.getSpaceQuota()); assertEquals(HdfsConstants.QUOTA_RESET, u0.getSpaceQuota());
assertEquals(fileSize * 3 * 2, u0.getSpaceConsumed()); assertEquals(fileSize * 3 * 2, u0.getSpaceConsumed());
verifyTypeQuotaAndConsume(new long[] {-1, -1, ssQuota * 2, -1, -1}, verifyTypeQuotaAndConsume(new long[] {-1, -1, -1, ssQuota * 2, -1, -1},
new long[] {0, 0, fileSize * 3 * 2, 0, 0}, u0); new long[] {0, 0, 0, fileSize * 3 * 2, 0, 0}, u0);
} }
@Test @Test