diff --git a/pulsar/consumer_test.go b/pulsar/consumer_test.go index 3445f4254..8e9534263 100644 --- a/pulsar/consumer_test.go +++ b/pulsar/consumer_test.go @@ -121,7 +121,8 @@ func TestProducerConsumer(t *testing.T) { func TestConsumerConnectError(t *testing.T) { client, err := NewClient(ClientOptions{ - URL: "pulsar://invalid-hostname:6650", + URL: "pulsar://invalid-hostname:6650", + OperationTimeout: 5 * time.Second, }) assert.Nil(t, err) @@ -137,7 +138,7 @@ func TestConsumerConnectError(t *testing.T) { assert.Nil(t, consumer) assert.NotNil(t, err) - assert.ErrorContains(t, err, "connection error") + assert.ErrorContains(t, err, "failed to connect to broker") } func TestBatchMessageReceive(t *testing.T) { diff --git a/pulsar/producer_test.go b/pulsar/producer_test.go index 24939a82b..f1bdba8e7 100644 --- a/pulsar/producer_test.go +++ b/pulsar/producer_test.go @@ -58,7 +58,8 @@ func TestInvalidURL(t *testing.T) { func TestProducerConnectError(t *testing.T) { client, err := NewClient(ClientOptions{ - URL: "pulsar://invalid-hostname:6650", + URL: "pulsar://invalid-hostname:6650", + OperationTimeout: 5 * time.Second, }) assert.Nil(t, err) @@ -73,7 +74,7 @@ func TestProducerConnectError(t *testing.T) { assert.Nil(t, producer) assert.NotNil(t, err) - assert.ErrorContains(t, err, "connection error") + assert.ErrorContains(t, err, "failed to connect to broker") } func TestProducerNoTopic(t *testing.T) { diff --git a/pulsar/reader_test.go b/pulsar/reader_test.go index 836535704..63bdbc9b1 100644 --- a/pulsar/reader_test.go +++ b/pulsar/reader_test.go @@ -205,7 +205,8 @@ func TestReaderOnPartitionedTopic(t *testing.T) { func TestReaderConnectError(t *testing.T) { client, err := NewClient(ClientOptions{ - URL: "pulsar://invalid-hostname:6650", + URL: "pulsar://invalid-hostname:6650", + OperationTimeout: 5 * time.Second, }) assert.Nil(t, err) @@ -221,7 +222,7 @@ func TestReaderConnectError(t *testing.T) { assert.Nil(t, reader) assert.NotNil(t, err) - assert.ErrorContains(t, err, "connection error") + assert.ErrorContains(t, err, "failed to connect to broker") } func TestReaderOnSpecificMessage(t *testing.T) {