Skip to content

Commit

Permalink
Cleanup topics after unit tests (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiyaoWei committed Mar 30, 2022
1 parent 925da1a commit ae400ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pulsar/client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion pulsar/producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit ae400ca

Please sign in to comment.