Skip to content

Commit

Permalink
Fix flakiness of BrokerRegistryIntegrationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
BewareMyPower committed Sep 27, 2024
1 parent 34b7f7e commit a220390
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ protected void cleanup() throws Exception {
@Test
public void testRecoverFromNodeDeletion() throws Exception {
// Simulate the case that the node was somehow deleted (e.g. by session timeout)
Assert.assertEquals(brokerRegistry.getAvailableBrokersAsync().get(), List.of(pulsar.getBrokerId()));
Awaitility.await().atMost(Duration.ofSeconds(3)).untilAsserted(() -> Assert.assertEquals(
brokerRegistry.getAvailableBrokersAsync().join(), List.of(pulsar.getBrokerId())));
pulsar.getLocalMetadataStore().delete(brokerMetadataPath, Optional.empty());
Awaitility.await().atMost(Duration.ofSeconds(3)).untilAsserted(() -> Assert.assertEquals(
brokerRegistry.getAvailableBrokersAsync().join(), List.of(pulsar.getBrokerId())));
Expand All @@ -89,6 +90,8 @@ public void testRecoverFromNodeDeletion() throws Exception {

@Test
public void testRegisterAgain() throws Exception {
Awaitility.await().atMost(Duration.ofSeconds(3)).untilAsserted(() -> Assert.assertEquals(
brokerRegistry.getAvailableBrokersAsync().join(), List.of(pulsar.getBrokerId())));
final var metadataStore = pulsar.getLocalMetadataStore();
final var oldResult = metadataStore.get(brokerMetadataPath).get().orElseThrow();
log.info("Old result: {} {}", new String(oldResult.getValue()), oldResult.getStat().getVersion());
Expand Down

0 comments on commit a220390

Please sign in to comment.