You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/06/10 12:28:29 UTC
(pulsar) 04/05: [fix][test] Deflake TopicPoliciesTest.setupTestTopic by retrying forced namespace deletion (#25974)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 72e4d26482026574c5a2346162984bc24649debc
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Mon Jun 8 23:42:01 2026 +0300
[fix][test] Deflake TopicPoliciesTest.setupTestTopic by retrying forced namespace deletion (#25974)
---
.../org/apache/pulsar/broker/admin/TopicPoliciesTest.java | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
index 0a1c76ff226..3621c9f21d5 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
@@ -175,16 +175,11 @@ public class TopicPoliciesTest extends MockedPulsarServiceBaseTest {
} catch (PulsarAdminException.NotFoundException e) {
// topic may already be deleted
}
- try {
- admin.namespaces().deleteNamespace(myNamespace, true);
- } catch (PulsarAdminException.NotFoundException e) {
- // namespace may already be deleted
- }
- try {
- admin.namespaces().deleteNamespace(myNamespaceV1, true);
- } catch (PulsarAdminException.NotFoundException e) {
- // namespace may already be deleted
- }
+ // Use deleteNamespaceWithRetry since the forced namespace deletion can fail transiently with HTTP 422 when a
+ // topic deletion in the cascade races with concurrent topic loading; the helper retries and treats an
+ // already-deleted namespace as success.
+ deleteNamespaceWithRetry(myNamespace, true);
+ deleteNamespaceWithRetry(myNamespaceV1, true);
admin.namespaces().createNamespace(testTenant + "/" + testNamespace, Set.of("test"));
admin.namespaces().createNamespace(myNamespaceV1);
admin.topics().createPartitionedTopic(testTopic, testTopicPartitions);