Maxwell-Guo commented on code in PR #4228: URL: https://github.com/apache/cassandra/pull/4228#discussion_r2192320366
########## test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java: ########## @@ -969,6 +969,34 @@ public void testReduceScopeL0L1() throws IOException } } + @Test() + public void testInvalidFanoutAndSSTableSize() + { + try + { + Map<String, String> options = new HashMap<>(); + options.put("class", "LeveledCompactionStrategy"); + options.put("fanout_size", "90"); + options.put("sstable_size_in_mb", "1089"); + LeveledCompactionStrategy.validateOptions(options); + Assert.fail("fanout_sizeed and sstable_size_in_mb are invalid, but did not throw ConfigurationException"); + } + catch (ConfigurationException e) + { + assertTrue(e.getMessage().contains("your maxSSTableSize must be absurdly high to compute")); + } + } + + @Test + public void testValidOptions() + { + Map<String, String> options = new HashMap<>(); + options.put("class", "LeveledCompactionStrategy"); + options.put("fanout_size", "10"); + options.put("sstable_size_in_mb", "160"); + LeveledCompactionStrategy.validateOptions(options); Review Comment: do we really need this test case ? ########## test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java: ########## @@ -969,6 +969,34 @@ public void testReduceScopeL0L1() throws IOException } } + @Test() + public void testInvalidFanoutAndSSTableSize() + { + try + { + Map<String, String> options = new HashMap<>(); + options.put("class", "LeveledCompactionStrategy"); + options.put("fanout_size", "90"); + options.put("sstable_size_in_mb", "1089"); + LeveledCompactionStrategy.validateOptions(options); + Assert.fail("fanout_sizeed and sstable_size_in_mb are invalid, but did not throw ConfigurationException"); Review Comment: see this test case, https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java#L38 expectedFailure is more readable . ########## test/unit/org/apache/cassandra/cql3/SimpleQueryTest.java: ########## @@ -561,6 +564,32 @@ public void testSStableTimestampOrdering() throws Throwable assertRows(execute("SELECT * FROM %s WHERE k1=1"), row(1, 1, 2)); } + @Test + public void testInvalidCompactionOptions() + { + try + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + Review Comment: nit : Formatting issue, should be in the same line as above, or aligned with above ########## test/unit/org/apache/cassandra/cql3/SimpleQueryTest.java: ########## @@ -561,6 +564,32 @@ public void testSStableTimestampOrdering() throws Throwable assertRows(execute("SELECT * FROM %s WHERE k1=1"), row(1, 1, 2)); } + @Test + public void testInvalidCompactionOptions() + { + try + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + + "'fanout_size': '90', " + + "'sstable_size_in_mb': '1089'}"); + fail("fanout_sizeed and sstable_size_in_mb are invalid, but did not throw ConfigurationException"); + } + catch (ConfigurationException e) + { + assertTrue(e.getMessage().contains("your maxSSTableSize must be absurdly high to compute")); + } + } + + @Test + public void testValidCompactionOptions() + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + + "'fanout_size': '10', " + Review Comment: nit : Formatting issue, should be in the same line as above, or aligned with above ########## test/unit/org/apache/cassandra/cql3/SimpleQueryTest.java: ########## @@ -561,6 +564,32 @@ public void testSStableTimestampOrdering() throws Throwable assertRows(execute("SELECT * FROM %s WHERE k1=1"), row(1, 1, 2)); } + @Test + public void testInvalidCompactionOptions() + { + try + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + + "'fanout_size': '90', " + + "'sstable_size_in_mb': '1089'}"); + fail("fanout_sizeed and sstable_size_in_mb are invalid, but did not throw ConfigurationException"); + } + catch (ConfigurationException e) + { + assertTrue(e.getMessage().contains("your maxSSTableSize must be absurdly high to compute")); + } + } + + @Test + public void testValidCompactionOptions() + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + + "'fanout_size': '10', " + Review Comment: do we really need this test case ? ########## test/unit/org/apache/cassandra/cql3/SimpleQueryTest.java: ########## @@ -561,6 +564,32 @@ public void testSStableTimestampOrdering() throws Throwable assertRows(execute("SELECT * FROM %s WHERE k1=1"), row(1, 1, 2)); } + @Test + public void testInvalidCompactionOptions() + { + try + { + createTable("CREATE TABLE %s.test (k int PRIMARY KEY, v int) WITH compaction = {" + + "'class': 'LeveledCompactionStrategy', " + Review Comment: i think these test cases can be moved to https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java -- 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