From 91d8855cba5294da1ccb7bbb993a888934e8acee Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Fri, 26 Apr 2024 12:37:02 +0000 Subject: [PATCH] test(storage): use quicker backoff for TestInvoke (#10048) This speeds up the test to ~0.5s locally --- storage/invoke_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/invoke_test.go b/storage/invoke_test.go index d3549b235bb8..9d4a5cf232b8 100644 --- a/storage/invoke_test.go +++ b/storage/invoke_test.go @@ -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" @@ -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)