Skip to content

Commit

Permalink
create topic first
Browse files Browse the repository at this point in the history
  • Loading branch information
freeznet committed Jun 22, 2021
1 parent 68d2abe commit 704c968
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions pulsar/client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func TestTopicPartitions(t *testing.T) {
assert.Nil(t, err)
defer client.Close()

// Create topic with 5 partitions
// Create topic
err = httpPut("admin/v2/persistent/public/default/TestGetTopicPartitions/partitions", 5)
assert.Nil(t, err)

Expand Down Expand Up @@ -624,8 +624,14 @@ func TestHTTPSInsecureConnection(t *testing.T) {
})
assert.NoError(t, err)

topicName := newTopicName()

// Create topic
err = httpPut(fmt.Sprintf("admin/v2/persistent/public/default/%s", topicName), nil)
assert.Nil(t, err)

producer, err := client.CreateProducer(ProducerOptions{
Topic: newTopicName(),
Topic: topicName,
})

assert.NoError(t, err)
Expand All @@ -641,8 +647,14 @@ func TestHTTPSConnection(t *testing.T) {
})
assert.NoError(t, err)

topicName := newTopicName()

// Create topic
err = httpPut(fmt.Sprintf("admin/v2/persistent/public/default/%s", topicName), nil)
assert.Nil(t, err)

producer, err := client.CreateProducer(ProducerOptions{
Topic: newTopicName(),
Topic: topicName,
})

assert.NoError(t, err)
Expand All @@ -659,8 +671,14 @@ func TestHTTPSConnectionHostNameVerification(t *testing.T) {
})
assert.NoError(t, err)

topicName := newTopicName()

// Create topic with 5 partitions
err = httpPut(fmt.Sprintf("admin/v2/persistent/public/default/%s", topicName), nil)
assert.Nil(t, err)

producer, err := client.CreateProducer(ProducerOptions{
Topic: newTopicName(),
Topic: topicName,
})

assert.NoError(t, err)
Expand Down Expand Up @@ -711,6 +729,9 @@ func TestHTTPTopicPartitions(t *testing.T) {
}

// Non-Partitioned topic
err = httpPut("admin/v2/persistent/public/default/TestHTTPTopicPartitions-nopartitions", nil)
assert.Nil(t, err)

topic := "persistent://public/default/TestHTTPTopicPartitions-nopartitions"

partitions, err = client.TopicPartitions(topic)
Expand All @@ -728,8 +749,12 @@ func TestRetryWithMultipleHttpHosts(t *testing.T) {
assert.Nil(t, err)
defer client.Close()

topic := "persistent://public/default/retry-multiple-hosts-" + generateRandomName()
topic := "retry-multiple-hosts-" + generateRandomName()

err = httpPut("admin/v2/persistent/public/default/"+topic, nil)
assert.Nil(t, err)

topic = "persistent://public/default/" + topic
producer, err := client.CreateProducer(ProducerOptions{
Topic: topic,
})
Expand Down

0 comments on commit 704c968

Please sign in to comment.