fix(bigqueryanalyticshub): pass token source to BigQuery client in multi region listing#16236
Conversation
|
Hello! I am a robot. Tests will require approval from a repository maintainer to run. Googlers: For automatic test runs see go/terraform-auto-test-runs. @NickElliot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
|
@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
|
🔴 The provider crashed while running the VCR tests in REPLAYING mode |
|
Hey @wj-chen @NickElliot , are these fails related to our change? |
|
Hey, can anyone run the VCR tests again please? |
|
@GoogleCloudPlatform/terraform-team @NickElliot This PR has been waiting for review for 1 week. Please take a look! Use the label |
|
I also don't have permission to trigger test runs. @NickElliot could you review? |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 5986 Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made. Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer. 🟢 All tests passed! |
|
I feel the fail - |
afa81b1
Description
This PR fixes an authentication bug in the BigQuery Analytics Hub multi-region acceptance tests that caused failures.
The multi-region support for Listings and Subscriptions requires custom bootstrapping to create BigQuery dataset replicas via the Go client library before the Terraform tests can run. In environments where Application Default Credentials (ADC) are not locally present on the disk, the standalone BigQuery client was unable to authenticate
Bug Details
The tests TestAccBigqueryAnalyticsHubListingSubscription_multiregion and TestAccBigqueryAnalyticsHubListing_multiregion failed with the following error during the bootstrapping phase:
resource_bigquery_analytics_hub_listing_subscription_test.go:72: Failed to create BigQuery dataset and add replica: failed to create BigQuery client: bigquery: constructing client: credentials: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more informationFix Details
The fix ensures that the bootstrapping code uses the exact same authenticated TokenSource and User Agent as the Terraform provider itself.
Updated AddBigQueryDatasetReplica and CleanupBigQueryDatasetAndReplica in bootstrap_test_utils.go.tmpl to accept t *testing.T and initialize the BigQuery client using the provider's TokenSource.
Updated the test templates to correctly pass the test object t to these helper functions.
References
Fixes https://buganizer.corp.google.com/issues/478720548 , https://buganizer.corp.google.com/issues/478719495
Supersedes logic from PR #16156
See Write release notes for guidance.