smiklosovic commented on code in PR #3002:
URL: https://github.com/apache/cassandra/pull/3002#discussion_r1471144304
##########
test/unit/org/apache/cassandra/auth/AuthCacheTest.java:
##########
@@ -322,6 +322,41 @@ public void
testCacheLoaderIsNotCalledOnGetAllWhenCacheIsNotEmpty()
assertEquals(1, loadCounter);
}
+ @Test
+ public void testMetricsOnCacheEnabled()
+ {
+ TestCache authCache = new TestCache(this::countingLoader,
this::emptyBulkLoader, this::setValidity, () -> validity, () -> isCacheEnabled);
+ authCache.get("10");
+ authCache.get("11");
+
+ assertThat(authCache.getMetrics().requests.getCount()).isEqualTo(2L);
+ assertThat(authCache.getMetrics().hits.getCount()).isEqualTo(0L);
+ assertThat(authCache.getMetrics().misses.getCount()).isEqualTo(2L);
+ assertEquals(2, loadCounter);
+
+ authCache.get("10");
+ authCache.get("11");
+
+ assertThat(authCache.getMetrics().requests.getCount()).isEqualTo(4L);
+ assertThat(authCache.getMetrics().hits.getCount()).isEqualTo(2L);
+ assertThat(authCache.getMetrics().misses.getCount()).isEqualTo(2L);
+ assertEquals(2, loadCounter);
+ }
+
+ @Test
+ public void testMetricsOnCacheDisabled()
Review Comment:
I dont think that involving _JMX_ is necessary. We basically just need to
invoke same MBean method programmatically. I have added "testSettingMaxEntries"
test for that.
--
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]