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 1a4915b
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions pulsar/client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ func TestTopicPartitions(t *testing.T) {
assert.Nil(t, err)
defer client.Close()

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

partitionedTopic := "persistent://public/default/TestGetTopicPartitions"
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 Down

0 comments on commit 1a4915b

Please sign in to comment.