smiklosovic commented on code in PR #4433:
URL: https://github.com/apache/cassandra/pull/4433#discussion_r2468815110
##########
test/unit/org/apache/cassandra/service/GCInspectorTest.java:
##########
@@ -43,49 +48,98 @@ public void before()
@Test
public void ensureStaticFieldsHydrateFromConfig()
{
- Assert.assertEquals(DatabaseDescriptor.getGCLogThreshold(),
gcInspector.getGcLogThresholdInMs());
- Assert.assertEquals(DatabaseDescriptor.getGCWarnThreshold(),
gcInspector.getGcWarnThresholdInMs());
+ assertEquals(DatabaseDescriptor.getGCLogThreshold(),
gcInspector.getGcLogThresholdInMs());
+ assertEquals(DatabaseDescriptor.getGCWarnThreshold(),
gcInspector.getGcWarnThresholdInMs());
+ assertEquals(DatabaseDescriptor.getGCConcurrentPhaseLogThreshold(),
gcInspector.getGcConcurrentPhaseLogThresholdInMs());
+ assertEquals(DatabaseDescriptor.getGCConcurrentPhaseWarnThreshold(),
gcInspector.getGcConcurrentPhaseWarnThresholdInMs());
}
@Test
public void ensureStatusIsCalculated()
{
- Assert.assertTrue(gcInspector.getStatusThresholdInMs() > 0);
+ assertTrue(gcInspector.getStatusThresholdInMs() > 0);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test
public void ensureWarnGreaterThanLog()
{
-
gcInspector.setGcWarnThresholdInMs(gcInspector.getGcLogThresholdInMs());
+ try
+ {
+
gcInspector.setGcWarnThresholdInMs(gcInspector.getGcLogThresholdInMs());
+ fail("Expect IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ try
+ {
+
gcInspector.setGcConcurrentPhaseWarnThresholdInMs(gcInspector.getGcConcurrentPhaseLogThresholdInMs());
+ fail("Expect IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
}
@Test
public void ensureZeroIsOk()
{
gcInspector.setGcWarnThresholdInMs(0);
- Assert.assertEquals(gcInspector.getStatusThresholdInMs(),
gcInspector.getGcLogThresholdInMs());
- Assert.assertEquals(0, DatabaseDescriptor.getGCWarnThreshold());
- Assert.assertEquals(200, DatabaseDescriptor.getGCLogThreshold());
+ assertEquals(gcInspector.getStatusThresholdInMs(),
gcInspector.getGcLogThresholdInMs());
+ assertEquals(0, DatabaseDescriptor.getGCWarnThreshold());
+ assertEquals(200, DatabaseDescriptor.getGCLogThreshold());
+
+ gcInspector.setGcConcurrentPhaseWarnThresholdInMs(0);
+ assertEquals(0,
DatabaseDescriptor.getGCConcurrentPhaseWarnThreshold());
+ assertEquals(1000,
DatabaseDescriptor.getGCConcurrentPhaseLogThreshold());
}
- @Test(expected=IllegalArgumentException.class)
+ @Test
public void ensureLogLessThanWarn()
{
- Assert.assertEquals(200, gcInspector.getGcLogThresholdInMs());
+ assertEquals(200, gcInspector.getGcLogThresholdInMs());
gcInspector.setGcWarnThresholdInMs(1000);
- Assert.assertEquals(1000, gcInspector.getGcWarnThresholdInMs());
- gcInspector.setGcLogThresholdInMs(gcInspector.getGcWarnThresholdInMs()
+ 1);
+ assertEquals(1000, gcInspector.getGcWarnThresholdInMs());
+ try
+ {
+
gcInspector.setGcLogThresholdInMs(gcInspector.getGcWarnThresholdInMs() + 1);
+ fail("Expect IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ assertEquals(1000, gcInspector.getGcConcurrentPhaseLogThresholdInMs());
+ gcInspector.setGcConcurrentPhaseWarnThresholdInMs(2000);
+ assertEquals(2000,
gcInspector.getGcConcurrentPhaseWarnThresholdInMs());
+ try
Review Comment:
Assertions.assertThrownBy
--
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]