Skip to content

Commit

Permalink
test(compute): fix a flaky test (#4769)
Browse files Browse the repository at this point in the history
attempt to fix #4741
  • Loading branch information
georgiyekkert committed Sep 21, 2021
1 parent f698e67 commit 6861b30
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions compute/apiv1/smoke_test.go
Expand Up @@ -20,6 +20,10 @@ import (
"context"
"fmt"
"testing"
"time"

"cloud.google.com/go/internal"
"github.com/googleapis/gax-go/v2"

"github.com/google/go-cmp/cmp"

Expand Down Expand Up @@ -564,11 +568,16 @@ func TestCapitalLetter(t *testing.T) {
t.Error(err)
}
defer func() {
_, err := c.Delete(ctx,
&computepb.DeleteFirewallRequest{
Project: projectId,
Firewall: name,
})
timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
err = internal.Retry(timeoutCtx, gax.Backoff{}, func() (stop bool, err error) {
_, err = c.Delete(timeoutCtx,
&computepb.DeleteFirewallRequest{
Project: projectId,
Firewall: name,
})
return err == nil, err
})
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 6861b30

Please sign in to comment.