From 015bc870ae8d21601aaa993835a28413d5ea3da7 Mon Sep 17 00:00:00 2001 From: Ziyao Wei Date: Tue, 29 Mar 2022 14:12:06 -0400 Subject: [PATCH] Cleanup topics after unit tests --- pulsar/client_impl_test.go | 8 ++++++-- pulsar/producer_test.go | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pulsar/client_impl_test.go b/pulsar/client_impl_test.go index e9e94af95e..2d83c99fad 100644 --- a/pulsar/client_impl_test.go +++ b/pulsar/client_impl_test.go @@ -348,7 +348,9 @@ func TestTopicPartitions(t *testing.T) { defer client.Close() // Create topic with 5 partitions - err = httpPut("admin/v2/persistent/public/default/TestGetTopicPartitions/partitions", 5) + topicAdminURL := "admin/v2/persistent/public/default/TestGetTopicPartitions/partitions" + err = httpPut(topicAdminURL, 5) + defer httpDelete(topicAdminURL) assert.Nil(t, err) partitionedTopic := "persistent://public/default/TestGetTopicPartitions" @@ -697,7 +699,9 @@ func TestHTTPTopicPartitions(t *testing.T) { defer client.Close() // Create topic with 5 partitions - err = httpPut("admin/v2/persistent/public/default/TestHTTPTopicPartitions/partitions", 5) + topicAdminURL := "admin/v2/persistent/public/default/TestHTTPTopicPartitions/partitions" + err = httpPut(topicAdminURL, 5) + defer httpDelete(topicAdminURL) assert.Nil(t, err) partitionedTopic := "persistent://public/default/TestHTTPTopicPartitions" diff --git a/pulsar/producer_test.go b/pulsar/producer_test.go index 124c82818d..3c526bbbed 100644 --- a/pulsar/producer_test.go +++ b/pulsar/producer_test.go @@ -509,7 +509,9 @@ func TestRoundRobinRouterPartitionedProducer(t *testing.T) { func TestMessageRouter(t *testing.T) { // Create topic with 5 partitions - err := httpPut("admin/v2/persistent/public/default/my-partitioned-topic/partitions", 5) + topicAdminURL := "admin/v2/persistent/public/default/my-partitioned-topic/partitions" + err := httpPut(topicAdminURL, 5) + defer httpDelete(topicAdminURL) if err != nil { t.Fatal(err) }