From 415ecc0b7904e5bad5c27ed16221ab057ef27251 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Tue, 28 Apr 2026 08:10:45 -0700 Subject: [PATCH] [fix][test] Fix flaky ExtensibleLoadManagerImplTest.testLoadBalancerServiceUnitTableViewSyncer playLeader() and playFollower() run on a single-threaded loadManagerExecutor, so playLeader() on the new leader can be queued behind a still-running playFollower() from the prior demotion. The syncer.start() work itself opens both table views and runs syncExistingItems/syncTailItems. Under CI load this serial chain can exceed the previous 30s timeout. Increase the timeout to 60s for both syncer-state checks (active on new leader, inactive on demoted follower) and the symmetric pair in the cleanup section after the dynamic config is removed. --- .../extensions/ExtensibleLoadManagerImplTest.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java index 4aa3c3ad7a8ac..35459a252304a 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java @@ -1376,10 +1376,15 @@ public void testLoadBalancerServiceUnitTableViewSyncer() throws Exception { assertTrue(pulsar2.getConfiguration().isLoadBalancerServiceUnitTableViewSyncerEnabled())); makeSecondaryAsLeader(); makePrimaryAsLeader(); - Awaitility.await().atMost(30, TimeUnit.SECONDS) + // playLeader()/playFollower() run on a single-threaded loadManagerExecutor, so + // playLeader() on the new leader can be queued behind a still-running playFollower() + // from the prior demotion. Under CI load this serial chain plus the syncer.start() + // work (which opens both table views and runs syncExistingItems/syncTailItems) + // can take longer than 30s, so use a more generous timeout here. + Awaitility.await().atMost(60, TimeUnit.SECONDS) .untilAsserted(() -> assertTrue(primaryLoadManager.getServiceUnitStateTableViewSyncer() .isActive())); - Awaitility.await().atMost(30, TimeUnit.SECONDS) + Awaitility.await().atMost(60, TimeUnit.SECONDS) .untilAsserted(() -> assertFalse(secondaryLoadManager.getServiceUnitStateTableViewSyncer() .isActive())); ServiceConfiguration defaultConf = getDefaultConf(); @@ -1590,10 +1595,10 @@ public void testLoadBalancerServiceUnitTableViewSyncer() throws Exception { Awaitility.await().untilAsserted(() -> assertFalse(pulsar2.getConfiguration().isLoadBalancerServiceUnitTableViewSyncerEnabled())); makeSecondaryAsLeader(); - Awaitility.await().atMost(30, TimeUnit.SECONDS) + Awaitility.await().atMost(60, TimeUnit.SECONDS) .untilAsserted(() -> assertFalse(primaryLoadManager.getServiceUnitStateTableViewSyncer() .isActive())); - Awaitility.await().atMost(30, TimeUnit.SECONDS) + Awaitility.await().atMost(60, TimeUnit.SECONDS) .untilAsserted(() -> assertFalse(secondaryLoadManager.getServiceUnitStateTableViewSyncer() .isActive())); }