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

fix(bigquery): bq connection auth scopes #6752

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions bigquery/integration_test.go
Expand Up @@ -157,7 +157,8 @@ func initIntegrationTest() func() {
}
bqOpts := []option.ClientOption{option.WithTokenSource(ts)}
sOpts := []option.ClientOption{option.WithTokenSource(testutil.TokenSource(ctx, storage.ScopeFullControl))}
ptmOpts := []option.ClientOption{option.WithTokenSource(testutil.TokenSource(ctx, "https://www.googleapis.com/auth/cloud-platform"))}
ptmOpts := []option.ClientOption{option.WithTokenSource(testutil.TokenSource(ctx, datacatalog.DefaultAuthScopes()...))}
connOpts := []option.ClientOption{option.WithTokenSource(testutil.TokenSource(ctx, connection.DefaultAuthScopes()...))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we just use the cloud platform scope directly here as well?? The default is bigquery + cloud platform, but cloud-platform already contains bigquery.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is an error on the connection.DefaultAuthScopes method, as it returns both scopes. For me is easier to understand the code by using that method instead of putting a scope directly, but you're right, the cloud-platform scope would cover what is needed.

cleanup := func() {}
now := time.Now().UTC()
if *record {
Expand Down Expand Up @@ -196,6 +197,7 @@ func initIntegrationTest() func() {
bqOpts = append(bqOpts, grpcHeadersChecker.CallOptions()...)
sOpts = append(sOpts, grpcHeadersChecker.CallOptions()...)
ptmOpts = append(ptmOpts, grpcHeadersChecker.CallOptions()...)
connOpts = append(sOpts, grpcHeadersChecker.CallOptions()...)
}
var err error
client, err = NewClient(ctx, projID, bqOpts...)
Expand All @@ -210,7 +212,7 @@ func initIntegrationTest() func() {
if err != nil {
log.Fatalf("datacatalog.NewPolicyTagManagerClient: %v", err)
}
connectionsClient, err = connection.NewClient(ctx, sOpts...)
connectionsClient, err = connection.NewClient(ctx, connOpts...)
if err != nil {
log.Fatalf("connection.NewService: %v", err)
}
Expand Down