gaoran10 commented on code in PR #25246:
URL: https://github.com/apache/pulsar/pull/25246#discussion_r2807701715


##########
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java:
##########
@@ -739,4 +741,18 @@ public void testNoBackoffMetadataCacheConfig() {
         assertTrue(backoff.isMandatoryStopMade());
         assertEquals(backoff.getFirstBackoffTimeInMillis(), 0);
     }
+
+    @Test
+    public void testRefreshRace() throws Exception {
+        @Cleanup final var store = new 
LocalMemoryMetadataStore("memory:local", MetadataStoreConfig.builder().build());
+        final var cache = store.getMetadataCache(String.class);
+        for (int i = 0; i < 500; i++) {
+            final var key = "/key" + i;
+            assertTrue(cache.get(key).get().isEmpty());
+
+            store.put(key, "\"value\"".getBytes(StandardCharsets.UTF_8), 
Optional.empty()).get();
+            
Awaitility.await().pollInterval(Duration.ofMillis(1)).atMost(Duration.ofSeconds(3)).untilAsserted(()
 ->

Review Comment:
   Why does the test need to wait here?



-- 
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]

Reply via email to