Skip to content

Commit

Permalink
test(pubsub): increase TestIntegration_All timeout for Pull flakiness (
Browse files Browse the repository at this point in the history
  • Loading branch information
hongalex committed Feb 4, 2022
1 parent f0210f0 commit 93ccb57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pubsub/integration_test.go
Expand Up @@ -310,14 +310,15 @@ func testPublishAndReceive(t *testing.T, client *Client, maxMsgs int, synchronou
// Use a timeout to ensure that Pull does not block indefinitely if there are
// unexpectedly few messages available.
now := time.Now()
timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute)
timeout := 3 * time.Minute
timeoutCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
gotMsgs, err := pullN(timeoutCtx, sub, len(want), func(ctx context.Context, m *Message) {
m.Ack()
})
if err != nil {
if c := status.Convert(err); c.Code() == codes.Canceled {
if time.Since(now) >= time.Minute {
if time.Since(now) >= timeout {
t.Fatal("pullN took too long")
}
} else {
Expand Down

0 comments on commit 93ccb57

Please sign in to comment.