This is an automated email from the ASF dual-hosted git repository. coderzc pushed a commit to branch branch-4.0 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 6d4979160a051dac02b733e55dd076decbb90513 Author: Matteo Merli <[email protected]> AuthorDate: Fri May 1 06:11:51 2026 -0700 [fix][test] Make NamespacesTest.cleanupAfterMethod tolerant of transient infra failures (#25641) --- .../org/apache/pulsar/broker/admin/NamespacesTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java index da3ced47efc..5048fc4ca08 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java @@ -187,12 +187,18 @@ public class NamespacesTest extends MockedPulsarServiceBaseTest { } @AfterMethod(alwaysRun = true) - public void cleanupAfterMethod() throws Exception{ - // cleanup. + public void cleanupAfterMethod() { + // Best-effort cleanup. Transient infra failures (e.g. ZK session expiry from a + // long-running test or GC pause) can make the admin call fail here; log and + // continue so the test method's actual result is preserved. Set<String> existsNsSetAferSetup = Stream.concat(testLocalNamespaces.stream(), testGlobalNamespaces.stream()) .map(Objects::toString).collect(Collectors.toSet()); - cleanupNamespaceByPredicate(this.testTenant, v -> !existsNsSetAferSetup.contains(v)); - cleanupNamespaceByPredicate(this.testOtherTenant, v -> !existsNsSetAferSetup.contains(v)); + try { + cleanupNamespaceByPredicate(this.testTenant, v -> !existsNsSetAferSetup.contains(v)); + cleanupNamespaceByPredicate(this.testOtherTenant, v -> !existsNsSetAferSetup.contains(v)); + } catch (Exception e) { + log.warn().exception(e).log("Failed to clean up namespaces after test method"); + } } protected void customizeNewPulsarClientBuilder(ClientBuilder clientBuilder) {
