dcapwell commented on code in PR #4087:
URL: https://github.com/apache/cassandra/pull/4087#discussion_r2047823574


##########
test/unit/org/apache/cassandra/db/compaction/unified/ControllerTest.java:
##########
@@ -121,6 +121,50 @@ public void testValidateOptionsIntegers()
         testValidateOptions(true);
     }
 
+    @Test
+    public void testValidateOptionsInvalidTargetSSTableSize()
+    {
+        //Test 1: TARGET_SSTABLE_SIZE_OPTION = 12E899, the value reported in 
CASSANDRA-20398 
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"12E899");
+            Controller.validateOptions(options);
+            fail("TARGET_SSTABLE_SIZE_OPTION = 12E899 should have caused 
exception");
+        } catch(ConfigurationException e) {
+        }

Review Comment:
   please remove the try/catch with empty catch 
   
   
   https://cassandra.apache.org/_/development/code_style.html
   
   >Never ever write catch (…) {} or catch (…) { logger.error() } merely to 
satisfy Java’s compile-time exception checking.



##########
test/unit/org/apache/cassandra/db/compaction/unified/ControllerTest.java:
##########
@@ -121,6 +121,50 @@ public void testValidateOptionsIntegers()
         testValidateOptions(true);
     }
 
+    @Test
+    public void testValidateOptionsInvalidTargetSSTableSize()
+    {
+        //Test 1: TARGET_SSTABLE_SIZE_OPTION = 12E899, the value reported in 
CASSANDRA-20398 
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"12E899");
+            Controller.validateOptions(options);
+            fail("TARGET_SSTABLE_SIZE_OPTION = 12E899 should have caused 
exception");
+        } catch(ConfigurationException e) {
+        }
+
+        //TEST 2: TARGET_SSTABLE_SIZE_OPTION > LONG.MAX_VALUE
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"9223372036854775907");
+            Controller.validateOptions(options);
+            fail("Passing TARGET_SSTABLE_SIZE_OPTION > LONG.MAX_VALUE should 
have caused exception");
+        } catch(ConfigurationException e) {

Review Comment:
   remove try/catch with empty catch



##########
test/unit/org/apache/cassandra/db/compaction/unified/ControllerTest.java:
##########
@@ -121,6 +121,50 @@ public void testValidateOptionsIntegers()
         testValidateOptions(true);
     }
 
+    @Test
+    public void testValidateOptionsInvalidTargetSSTableSize()
+    {
+        //Test 1: TARGET_SSTABLE_SIZE_OPTION = 12E899, the value reported in 
CASSANDRA-20398 
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"12E899");
+            Controller.validateOptions(options);
+            fail("TARGET_SSTABLE_SIZE_OPTION = 12E899 should have caused 
exception");
+        } catch(ConfigurationException e) {
+        }
+
+        //TEST 2: TARGET_SSTABLE_SIZE_OPTION > LONG.MAX_VALUE
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"9223372036854775907");
+            Controller.validateOptions(options);
+            fail("Passing TARGET_SSTABLE_SIZE_OPTION > LONG.MAX_VALUE should 
have caused exception");
+        } catch(ConfigurationException e) {
+        }
+
+        //TEST 3: TARGET_SSTABLE_SIZE_OPTION < Default MIN_TARGET_SSTABLE_SIZE 
(1048576)
+        try {
+            Map<String, String> options = new HashMap<>();
+            options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, 
"1048000");
+            Controller.validateOptions(options);
+            fail("Passing TARGET_SSTABLE_SIZE_OPTION < MIN_TARGET_SSTABLE_SIZE 
should have caused exception");
+        } catch(ConfigurationException e) {

Review Comment:
   remove try/catch with empty catch



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to