wchevreuil commented on a change in pull request #324: [HBASE-22606] : 
BucketCache additional tests
URL: https://github.com/apache/hbase/pull/324#discussion_r296542066
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java
 ##########
 @@ -322,13 +377,34 @@ public void testGetPartitionSize() throws IOException {
     conf.setFloat(BucketCache.MEMORY_FACTOR_CONFIG_NAME, 0.2f);
 
     BucketCache cache = new BucketCache(ioEngineName, capacitySize, 
constructedBlockSize,
-        constructedBlockSizes, writeThreads, writerQLen, persistencePath, 100, 
conf);
+        constructedBlockSizes, writeThreads, writerQLen, null, 100, conf);
 
     validateGetPartitionSize(cache, 0.1f, 0.5f);
     validateGetPartitionSize(cache, 0.7f, 0.5f);
     validateGetPartitionSize(cache, 0.2f, 0.5f);
   }
 
+  @Test
+  public void testCacheSizeCapacity() throws IOException {
+    validateGetPartitionSize(cache, BucketCache.DEFAULT_SINGLE_FACTOR,
+            BucketCache.DEFAULT_MIN_FACTOR);
+    Configuration conf = HBaseConfiguration.create();
+    conf.setFloat(BucketCache.MIN_FACTOR_CONFIG_NAME, 0.5f);
+    conf.setFloat(BucketCache.SINGLE_FACTOR_CONFIG_NAME, 0.1f);
+    conf.setFloat(BucketCache.MULTI_FACTOR_CONFIG_NAME, 0.7f);
+    conf.setFloat(BucketCache.MEMORY_FACTOR_CONFIG_NAME, 0.2f);
+    boolean isTestCompleted = false;
+    try {
+      new BucketCache(ioEngineName, Long.MAX_VALUE, 1, constructedBlockSizes, 
writeThreads,
+              writerQLen, null, 100, conf);
+    } catch (IllegalArgumentException e) {
 
 Review comment:
   You don't need the boolean if you just add a _fail("should had thrown 
IAE!")_ call right here after the constructor, but before the _catch_ block. If 
the constructor does not throw IAE, it will reach this line and fail the test. 
If any other runtime exception is thrown, it will give a test error anyways, 
since we are not defining it as _expected_ in the _@test_ annotation.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to