chirag-wadhwa5 commented on code in PR #19500:
URL: https://github.com/apache/kafka/pull/19500#discussion_r2049320462


##########
server/src/test/java/org/apache/kafka/server/share/session/ShareSessionCacheTest.java:
##########
@@ -44,75 +43,45 @@ public void setUp() {
 
     @Test
     public void testShareSessionCache() throws InterruptedException {
-        ShareSessionCache cache = new ShareSessionCache(3, 100);
+        ShareSessionCache cache = new ShareSessionCache(3);
         assertEquals(0, cache.size());
-        ShareSessionKey key1 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), 0, mockedSharePartitionMap(10));
-        ShareSessionKey key2 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), 10, mockedSharePartitionMap(20));
-        ShareSessionKey key3 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), 20, mockedSharePartitionMap(30));
-        assertNull(cache.maybeCreateSession("grp", Uuid.randomUuid(), 30, 
mockedSharePartitionMap(40)));
-        assertNull(cache.maybeCreateSession("grp", Uuid.randomUuid(), 40, 
mockedSharePartitionMap(5)));
+        ShareSessionKey key1 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), mockedSharePartitionMap(10));
+        ShareSessionKey key2 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), mockedSharePartitionMap(20));
+        ShareSessionKey key3 = cache.maybeCreateSession("grp", 
Uuid.randomUuid(), mockedSharePartitionMap(30));
+        assertNull(cache.maybeCreateSession("grp", Uuid.randomUuid(), 
mockedSharePartitionMap(40)));
+        assertNull(cache.maybeCreateSession("grp", Uuid.randomUuid(), 
mockedSharePartitionMap(5)));
         assertShareCacheContains(cache, List.of(key1, key2, key3));
 
-        TestUtils.waitForCondition(() -> 
yammerMetricValue(ShareSessionCache.SHARE_SESSIONS_COUNT).intValue() == 3,
-            "Share session count should be 3.");
-        TestUtils.waitForCondition(() -> 
yammerMetricValue(ShareSessionCache.SHARE_PARTITIONS_COUNT).intValue() == 60,
-            "Share partition count should be 60.");
-        assertEquals(0, cache.evictionsMeter().count());

Review Comment:
   Thanks for the review. These haven't been removed. I have put these 
assertions in a separate method `assertMetricsValues` because these checks are 
repeated in the tests.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to