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

lhotari pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit d0d5f52e87cbee71521b343f7d0aa6e8b0e89b7b
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)
    
    (cherry picked from commit ee7dc689408386f59c311c1d3f16eb35c793afca)
---
 .../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 6ff2d8a8216..16d53b6f96a 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("Failed to clean up namespaces after test method", e);
+        }
     }
 
     protected void customizeNewPulsarClientBuilder(ClientBuilder 
clientBuilder) {

Reply via email to