Demogorgon314 commented on a change in pull request #14373:
URL: https://github.com/apache/pulsar/pull/14373#discussion_r813505145
##########
File path:
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java
##########
@@ -233,7 +234,7 @@ public void insertionDeletionWitGenericType(String
provider, Supplier<String> ur
v.put("b", "2");
objCache.create(key1, v).join();
- assertEquals(objCache.getIfCached(key1), Optional.of(v));
+ assertEqualsAndRetry(() -> objCache.getIfCached(key1), Optional.of(v),
Optional.empty());
Review comment:
We need ensure ` objCache.getIfCached(key1)` only return
`Optional.empty()` or correct value.
If we use `Awaitility.await().untilAsserted(...);` here, when
`objCache.getIfCached(key1)` return a wrong value it still retry.
```java
Awaitility.await().untilAsserted(() -> {
assertEquals(objCache.getIfCached(key1), Optional.of(v));
});
```
If `Awaitility` can do what I said, please tell me. Thanks!
--
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]