From 627583458c634da09fbf5cece42c8d05ab7a5fa9 Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Thu, 16 Jun 2022 19:39:11 +0000 Subject: [PATCH] test(bigquery): address minor test issues in the first, the integration tests running too long came into conflict with a expiration time that was too short. lengthened the test accordingly. In the second, cleanup some usages of xerrors that can be moved to errors as we're now no longer supporting older go versions. --- bigquery/integration_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bigquery/integration_test.go b/bigquery/integration_test.go index 4dbf14a3c38a..71e1999f2f6b 100644 --- a/bigquery/integration_test.go +++ b/bigquery/integration_test.go @@ -17,6 +17,7 @@ package bigquery import ( "context" "encoding/json" + "errors" "flag" "fmt" "log" @@ -39,7 +40,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" gax "github.com/googleapis/gax-go/v2" - "golang.org/x/xerrors" "google.golang.org/api/googleapi" "google.golang.org/api/iterator" "google.golang.org/api/option" @@ -216,7 +216,7 @@ func initTestState(client *Client, t time.Time) func() { tableIDs = uid.NewSpace("table", opts) modelIDs = uid.NewSpace("model", opts) routineIDs = uid.NewSpace("routine", opts) - testTableExpiration = t.Add(10 * time.Minute).Round(time.Second) + testTableExpiration = t.Add(2 * time.Hour).Round(time.Second) // For replayability, seed the random source with t. Seed(t.UnixNano()) @@ -866,7 +866,7 @@ func TestIntegration_InsertErrors(t *testing.T) { t.Errorf("Wanted row size error, got successful insert.") } var e1 *googleapi.Error - ok := xerrors.As(err, &e1) + ok := errors.As(err, &e1) if !ok { t.Errorf("Wanted googleapi.Error, got: %v", err) } @@ -886,7 +886,7 @@ func TestIntegration_InsertErrors(t *testing.T) { t.Errorf("Wanted error, got successful insert.") } var e2 *googleapi.Error - ok = xerrors.As(err, &e2) + ok = errors.As(err, &e2) if !ok { t.Errorf("wanted googleapi.Error, got: %v", err) } @@ -1437,7 +1437,7 @@ func runQueryJob(ctx context.Context, q *Query) (*JobStatistics, *QueryStatistic job, err := q.Run(ctx) if err != nil { var e *googleapi.Error - if ok := xerrors.As(err, &e); ok && e.Code < 500 { + if ok := errors.As(err, &e); ok && e.Code < 500 { return true, err // fail on 4xx } return false, err @@ -1445,7 +1445,7 @@ func runQueryJob(ctx context.Context, q *Query) (*JobStatistics, *QueryStatistic _, err = job.Wait(ctx) if err != nil { var e *googleapi.Error - if ok := xerrors.As(err, &e); ok && e.Code < 500 { + if ok := errors.As(err, &e); ok && e.Code < 500 { return true, err // fail on 4xx } return false, fmt.Errorf("%q: %v", job.ID(), err) @@ -2792,7 +2792,7 @@ func (b byCol0) Less(i, j int) bool { func hasStatusCode(err error, code int) bool { var e *googleapi.Error - if ok := xerrors.As(err, &e); ok && e.Code == code { + if ok := errors.As(err, &e); ok && e.Code == code { return true } return false