jobs/v4: add retry to TestCommuteSearch
@@ -18,14 +18,16 @@ import (
"bytes"
"strings"
"testing"
+ "time"
"github.com/GoogleCloudPlatform/golang-samples/internal/testutil"
)
func TestCommuteSearch(t *testing.T) {
tc := testutil.SystemTest(t)
- buf := &bytes.Buffer{}
companyID := strings.SplitAfter(testCompany.Name, "companies/")[1]
+ testutil.Retry(t, 20, 2*time.Second, func(r *testutil.R) {
+ buf := &bytes.Buffer{}
if err := commuteSearch(buf, tc.ProjectID, companyID); err != nil {
t.Fatalf("commuteSearch: %v", err)
}
@@ -33,4 +35,5 @@ func TestCommuteSearch(t *testing.T) {
if got := buf.String(); !strings.Contains(got, want) {
t.Fatalf("commuteSearch got %q, want to contain %q", got, want)
}
+ })
}
