crossoverJie commented on code in PR #1459:
URL: https://github.com/apache/pulsar-client-go/pull/1459#discussion_r2915388553
##########
pulsar/consumer_test.go:
##########
@@ -5710,3 +5710,40 @@ func TestSelectConnectionForSameConsumer(t *testing.T) {
"The consumer uses a different connection when
reconnecting")
}
}
+
+/**
+ * Test that GetPartitionedTopicMetadata is not called when DLQ and Retry
topics are provided.
+ */
+func TestConsumerWithDLQRetryTopicNoGetPartitionedTopicMetadata(t *testing.T) {
+
+ type mockLookupService struct {
+ getPartitionedTopicMetadataCalled bool
+ callCount int
+ }
+
+ mockLS := &mockLookupService{}
+
+ client, _ := NewClient(ClientOptions{
+ URL: serviceURL,
+ MaxConnectionsPerBroker: 10,
+ })
+
+ options1 := ConsumerOptions{
+ Topic: "persistent://public/default/test-topic",
+ SubscriptionName: "test-subscription",
+ RetryEnable: true,
+ DLQ: &DLQPolicy{
+ MaxDeliveries: 3,
+ DeadLetterTopic:
"persistent://public/default/my-dlq-topic", // 用户自定义的 DLQ topic
+ RetryLetterTopic:
"persistent://public/default/my-retry-topic", // 用户自定义的 Retry topic
Review Comment:
Please use English commengts.
##########
pulsar/consumer_test.go:
##########
@@ -5710,3 +5710,40 @@ func TestSelectConnectionForSameConsumer(t *testing.T) {
"The consumer uses a different connection when
reconnecting")
}
}
+
+/**
+ * Test that GetPartitionedTopicMetadata is not called when DLQ and Retry
topics are provided.
+ */
+func TestConsumerWithDLQRetryTopicNoGetPartitionedTopicMetadata(t *testing.T) {
+
+ type mockLookupService struct {
+ getPartitionedTopicMetadataCalled bool
+ callCount int
+ }
+
+ mockLS := &mockLookupService{}
+
+ client, _ := NewClient(ClientOptions{
+ URL: serviceURL,
+ MaxConnectionsPerBroker: 10,
+ })
+
+ options1 := ConsumerOptions{
+ Topic: "persistent://public/default/test-topic",
+ SubscriptionName: "test-subscription",
+ RetryEnable: true,
+ DLQ: &DLQPolicy{
+ MaxDeliveries: 3,
+ DeadLetterTopic:
"persistent://public/default/my-dlq-topic", // 用户自定义的 DLQ topic
+ RetryLetterTopic:
"persistent://public/default/my-retry-topic", // 用户自定义的 Retry topic
+ },
+ }
+
+ _, _ = client.Subscribe(options1)
+
+ assert.False(t, mockLS.getPartitionedTopicMetadataCalled,
Review Comment:
This assertion condition will always pass; we need to cover the modified
code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]