Skip to content

Commit

Permalink
test(storage): use quicker backoff for TestInvoke (googleapis#10048)
Browse files Browse the repository at this point in the history
This speeds up the test to ~0.5s locally
  • Loading branch information
tritone authored Apr 26, 2024
1 parent 37bc73a commit 91d8855
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions storage/invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"regexp"
"strings"
"testing"
"time"

"github.com/googleapis/gax-go/v2"
"github.com/googleapis/gax-go/v2/callctx"
"golang.org/x/xerrors"
"google.golang.org/api/googleapi"
Expand Down Expand Up @@ -250,6 +252,11 @@ func TestInvoke(t *testing.T) {
}
return test.finalErr
}
// Use a short backoff to speed up the test.
if test.retry == nil {
test.retry = defaultRetry.clone()
}
test.retry.backoff = &gax.Backoff{Initial: time.Millisecond}
got := run(ctx, call, test.retry, test.isIdempotentValue)
if test.expectFinalErr && !errors.Is(got, test.finalErr) {
s.Errorf("got %v, want %v", got, test.finalErr)
Expand Down

0 comments on commit 91d8855

Please sign in to comment.