This is an automated email from the ASF dual-hosted git repository.
merlimat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 116212f5424 [fix][test] Fix flaky
AuditorBookieTest.testBookieClusterRestart (#26122)
116212f5424 is described below
commit 116212f5424d05da7affb078308d003d5e180423
Author: Lari Hotari <[email protected]>
AuthorDate: Wed Jul 1 03:51:27 2026 +0300
[fix][test] Fix flaky AuditorBookieTest.testBookieClusterRestart (#26122)
---
.../apache/bookkeeper/replication/AuditorBookieTest.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git
a/pulsar-metadata/src/test/java/org/apache/bookkeeper/replication/AuditorBookieTest.java
b/pulsar-metadata/src/test/java/org/apache/bookkeeper/replication/AuditorBookieTest.java
index 5b209fb686d..555d6721c56 100644
---
a/pulsar-metadata/src/test/java/org/apache/bookkeeper/replication/AuditorBookieTest.java
+++
b/pulsar-metadata/src/test/java/org/apache/bookkeeper/replication/AuditorBookieTest.java
@@ -133,13 +133,12 @@ public class AuditorBookieTest extends
BookKeeperClusterTestCase {
assertTrue("Auditor elector is not running!", auditorElector
.isRunning());
}
- stopBKCluster();
stopAuditorElectors();
-
- startBKCluster(zkUtil.getMetadataServiceUri());
- //startBKCluster(zkUtil.getMetadataServiceUri()) override the base
conf metadataServiceUri
- baseConf.setMetadataServiceUri(
- zkUtil.getMetadataServiceUri().replaceAll("zk://",
"metadata-store:").replaceAll("/ledgers", ""));
+ // Restart the bookies while preserving their identities (host:port
and data dirs).
+ // Tearing the cluster down and recreating bookies with fresh data
dirs on recycled
+ // ports fails bookie cookie validation against the cookies that are
still registered
+ // in the metadata store, which made this test flaky.
+ restartBookies();
startAuditorElectors();
BookieServer newAuditor = waitForNewAuditor(auditor);
assertNotSame(
@@ -219,6 +218,10 @@ public class AuditorBookieTest extends
BookKeeperClusterTestCase {
auditorElector.shutdown();
log.debug("Stopping Auditor Elector!");
}
+ // The same test instance is reused across test methods, so drop
references to the
+ // shut-down electors. Otherwise a later method that iterates over
auditorElectors
+ // (e.g. testBookieClusterRestart) would observe stale,
already-stopped electors.
+ auditorElectors.clear();
}
private BookieServer verifyAuditor() throws Exception {