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

Commit 46c9ce9

Browse files
authored
[improve][test] Reduce AdvertisedListenersMultiBrokerLeaderElectionTest flakiness (apache#22258)
1 parent 55625d9 commit 46c9ce9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/MultiBrokerLeaderElectionTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ public void shouldProvideConsistentAnswerToTopicLookupsUsingAdminApi()
108108
List<String> topicNames = IntStream.range(0, 500).mapToObj(i -> topicNameBase + i)
109109
.collect(Collectors.toList());
110110
List<PulsarAdmin> allAdmins = getAllAdmins();
111-
@Cleanup("shutdown")
111+
@Cleanup("shutdownNow")
112112
ExecutorService executorService = Executors.newFixedThreadPool(allAdmins.size());
113113
List<Future<List<String>>> resultFutures = new ArrayList<>();
114114
// use Phaser to increase the chances of a race condition by triggering all threads once
115115
// they are waiting just before each lookupTopic call
116+
@Cleanup("forceTermination")
116117
final Phaser phaser = new Phaser(1);
117118
for (PulsarAdmin brokerAdmin : allAdmins) {
118119
phaser.register();
@@ -149,11 +150,12 @@ public void shouldProvideConsistentAnswerToTopicLookupsUsingClient()
149150
List<String> topicNames = IntStream.range(0, 500).mapToObj(i -> topicNameBase + i)
150151
.collect(Collectors.toList());
151152
List<PulsarClient> allClients = getAllClients();
152-
@Cleanup("shutdown")
153+
@Cleanup("shutdownNow")
153154
ExecutorService executorService = Executors.newFixedThreadPool(allClients.size());
154155
List<Future<List<String>>> resultFutures = new ArrayList<>();
155156
// use Phaser to increase the chances of a race condition by triggering all threads once
156157
// they are waiting just before each lookupTopic call
158+
@Cleanup("forceTermination")
157159
final Phaser phaser = new Phaser(1);
158160
for (PulsarClient brokerClient : allClients) {
159161
phaser.register();

0 commit comments

Comments
 (0)