container_registry: retry PubSub test
@@ -267,9 +267,7 @@ func TestPubSub(t *testing.T) {
// Create a new subscription if it doesn't exist.
createOccurrenceSubscription(v.ctx, v.subID, v.projectID)
- // Run Pub/Sub to clear out any extra messages from the queue.
- occurrencePubsub(v.ctx, v.subID, 20, v.projectID)
-
+ testutil.Retry(t, v.tryLimit, time.Second, func(r *testutil.R) {
// Use a channel and a goroutine to count incomming messages.
c := make(chan int)
go func() {
@@ -292,8 +290,9 @@ func TestPubSub(t *testing.T) {
}
result := <-c
if result != totalCreated {
- t.Errorf("invalid occurrence count: %d; want: %d", result, totalCreated)
+ r.Errorf("invalid occurrence count: %d; want: %d", result, totalCreated)
}
+ })
// Clean up
client, _ := pubsub.NewClient(v.ctx, v.projectID)
