From f527a2293f88696242a6f5a68156a3e06ff5c8b7 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Sat, 30 Oct 2021 07:10:37 -0700 Subject: [PATCH] Fixed flaky test in LocalMemoryMetadataStoreTest (#12540) --- .../pulsar/metadata/LocalMemoryMetadataStoreTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LocalMemoryMetadataStoreTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LocalMemoryMetadataStoreTest.java index 0016d99083da2..0e7d1a2f27bff 100644 --- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LocalMemoryMetadataStoreTest.java +++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/LocalMemoryMetadataStoreTest.java @@ -45,6 +45,7 @@ import org.apache.pulsar.metadata.api.Notification; import org.apache.pulsar.metadata.api.NotificationType; import org.apache.pulsar.metadata.api.Stat; +import org.awaitility.Awaitility; import org.testng.annotations.Test; public class LocalMemoryMetadataStoreTest { @@ -84,7 +85,11 @@ public void testSharedInstance() throws Exception { store2.delete("/test", Optional.empty()).join(); - assertFalse(store1.exists("/test").join()); assertFalse(store2.exists("/test").join()); + + // The exists will be updated based on the cache invalidation in store1 + Awaitility.await().untilAsserted(() -> { + assertFalse(store1.exists("/test").join()); + }); } }