simbadzina commented on code in PR #6135:
URL: https://github.com/apache/hadoop/pull/6135#discussion_r1343261202
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java:
##########
@@ -1168,6 +1170,32 @@ public void testQuotaUpdateWhenDestinationNotPresent()
throws Exception {
assertEquals(0, quotaUsage.getSpaceConsumed());
}
+ @Test
+ public void testAndByStorageType() {
+ long[] typeQuota = new long[StorageType.values().length];
+ Arrays.fill(typeQuota, HdfsConstants.QUOTA_DONT_SET);
+
+ Predicate<StorageType> predicate = new Predicate<StorageType>() {
+ @Override
+ public boolean test(StorageType storageType) {
+ return typeQuota[storageType.ordinal()] ==
HdfsConstants.QUOTA_DONT_SET;
+ }
+ };
+
+ assertTrue(Quota.andByStorageType(predicate));
+
+ typeQuota[0] = 2023;
+ assertFalse(Quota.andByStorageType(predicate));
+
+ Arrays.fill(typeQuota, HdfsConstants.QUOTA_DONT_SET);
+ typeQuota[1] = 2023;
+ assertFalse(Quota.andByStorageType(predicate));
+
+ Arrays.fill(typeQuota, HdfsConstants.QUOTA_DONT_SET);
+ typeQuota[typeQuota.length-1] = 2023;
+ assertFalse(Quota.andByStorageType(predicate));
Review Comment:
I recommend using a constant like `HdfsConstants.QUOTA_RESET` here instead
of `2023`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]