PavelZeger commented on code in PR #1507:
URL: https://github.com/apache/pulsar-client-go/pull/1507#discussion_r3403435435


##########
pulsar/consumer_test.go:
##########
@@ -6441,3 +6441,224 @@ func TestIsNonRetriableSubscribeError(t *testing.T) {
                })
        }
 }
+
+func drainUntilTimeout(t *testing.T, consumer Consumer, perMsgTimeout 
time.Duration) int {
+       t.Helper()
+       count := 0
+       for {
+               ctx, cancel := context.WithTimeout(context.Background(), 
perMsgTimeout)
+               msg, err := consumer.Receive(ctx)
+               cancel()
+               if err != nil {
+                       return count
+               }

Review Comment:
   Agreed. The helper is meant to stop only when the per-message receive times 
out, so I now assert the error is `context.DeadlineExceeded` before returning. 
Any other error (consumer closed, connection issue, etc.) will now fail the 
test.
   



-- 
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]

Reply via email to