Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
[improve][test] Reduce AdvertisedListenersMultiBrokerLeaderElectionTe…
Browse files Browse the repository at this point in the history
…st flakiness (apache#22258)
  • Loading branch information
lhotari authored Mar 13, 2024
1 parent 55625d9 commit 46c9ce9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ public void shouldProvideConsistentAnswerToTopicLookupsUsingAdminApi()
List<String> topicNames = IntStream.range(0, 500).mapToObj(i -> topicNameBase + i)
.collect(Collectors.toList());
List<PulsarAdmin> allAdmins = getAllAdmins();
@Cleanup("shutdown")
@Cleanup("shutdownNow")
ExecutorService executorService = Executors.newFixedThreadPool(allAdmins.size());
List<Future<List<String>>> resultFutures = new ArrayList<>();
// use Phaser to increase the chances of a race condition by triggering all threads once
// they are waiting just before each lookupTopic call
@Cleanup("forceTermination")
final Phaser phaser = new Phaser(1);
for (PulsarAdmin brokerAdmin : allAdmins) {
phaser.register();
Expand Down Expand Up @@ -149,11 +150,12 @@ public void shouldProvideConsistentAnswerToTopicLookupsUsingClient()
List<String> topicNames = IntStream.range(0, 500).mapToObj(i -> topicNameBase + i)
.collect(Collectors.toList());
List<PulsarClient> allClients = getAllClients();
@Cleanup("shutdown")
@Cleanup("shutdownNow")
ExecutorService executorService = Executors.newFixedThreadPool(allClients.size());
List<Future<List<String>>> resultFutures = new ArrayList<>();
// use Phaser to increase the chances of a race condition by triggering all threads once
// they are waiting just before each lookupTopic call
@Cleanup("forceTermination")
final Phaser phaser = new Phaser(1);
for (PulsarClient brokerClient : allClients) {
phaser.register();
Expand Down

0 comments on commit 46c9ce9

Please sign in to comment.