Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(bigquery): address minor test issues #6202

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bigquery/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package bigquery
import (
"context"
"encoding/json"
"errors"
"flag"
"fmt"
"log"
Expand All @@ -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"
Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -1437,15 +1437,15 @@ 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
}
_, 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)
Expand Down Expand Up @@ -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
Expand Down