Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(pubsub): add retry guard to cancel receive test #8248

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions pubsub/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,23 @@ func TestIntegration_CancelReceive(t *testing.T) {
client := integrationTestClient(ctx, t)
defer client.Close()

topic, err := client.CreateTopic(ctx, topicIDs.New())
if err != nil {
t.Fatal(err)
}
var topic *Topic
var err error
testutil.Retry(t, 5, 1*time.Second, func(r *testutil.R) {
topic, err = client.CreateTopic(ctx, topicIDs.New())
if err != nil {
r.Errorf("failed to create topic: %v", err)
}
})
defer topic.Delete(ctx)
defer topic.Stop()

var sub *Subscription
if sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}); err != nil {
t.Fatal(err)
}
testutil.Retry(t, 5, 1*time.Second, func(r *testutil.R) {
if sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}); err != nil {
r.Errorf("failed to create subscription: %v", err)
}
})
defer sub.Delete(ctx)

sub.ReceiveSettings.MaxOutstandingMessages = -1
Expand Down