This is an automated email from the ASF dual-hosted git repository.

lhotari 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 ee7dc689408 [fix][test] Make NamespacesTest.cleanupAfterMethod 
tolerant of transient infra failures (#25641)
ee7dc689408 is described below

commit ee7dc689408386f59c311c1d3f16eb35c793afca
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 c6f66e14982..4ac64405c60 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
@@ -186,12 +186,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) {

Reply via email to