-
Couldn't load subscription status.
- Fork 208
chore: Adjust migration tests with SA and access token #3790
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
Conversation
* master: chore: Update SSDLC report for v2.1.0 chore: Updates CHANGELOG.md header for v2.1.0 release chore: Update example links in registry docs for v2.1.0 release chore: Add support for typed nested objects in autogen (#3801) chore: Update examples and doc to use SA instead of PAK (#3804) chore: Updates CHANGELOG.md for #3793 feat: Add workspace_name field in stream_processor resource and datasource (#3793) doc: Adds examples for advanced_cluster upgrade to v2.0 & improves documentation (#3767) chore: Fix tests using GetIndependentShardScalingMode (#3799) chore: Don't send notifications in PRs or release (#3797) test: Adds delay to avoid flakiness in TestAccProjectAPIKey_recreateWhenDeletedExternally (#3798) move CloseTokenSource call out of defer (#3796) chore: Revoke SA tokens after Terraform command finishes (#3794) chore: Fix send_notification in Test Suite (#3792) chore: Document Troubleshooting SA (#3791) build(deps): bump go.mongodb.org/atlas-sdk (#3776)
* master: chore: Invoke Delete operation if timeout in autogen (#3820) Add support for typed nested sets in autogen (#3819) chore: Use timeouts attributes in autogen resources (#3817) refactor: Adds invalid update error for delete_on_create_timeout for sdkv2 (#3810) Add support for typed lists in autogen (#3816) refactor: Uses delete_on_create_timeout with default=true support across TPF resources (#3809) Rename customtype package to customtypes (#3814) chore: Add support for typed nested lists in autogen (#3813) don't schedule matrix until CLOUDP-353513 (#3812) chore: Fix stream tests notifications (#3805) chore: Bump golang.org/x/oauth2 from 0.31.0 to 0.32.0 (#3803) depends on data sources (#3808) test: Avoids flaky test by simplifying the check, ensuring count > 0 instead of reading API response and trying exact match (#3806) chore: Generate timeouts attribute for autogen resources (#3802) # Conflicts: # .github/workflows/acceptance-tests-runner.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adjusts migration tests to work with Service Account (SA) authentication by introducing access token support. The change prevents token creation limit issues that occur when each migration test creates its own SA token. Migration tests using SA now run in dedicated GitHub Actions jobs using pre-created access tokens instead of SA credentials directly.
Key changes:
- Replaced
generate-oauth2-tokentool with enhancedaccess-tokentool that supports both token creation and revocation - Added access token authentication support alongside existing PAK and SA credential types
- Created dedicated GitHub Actions jobs for SA migration tests that use access tokens
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/generate-oauth2-token/main.go | Removed old OAuth2 token generation tool |
| tools/access-token/main.go | Added new tool with create/revoke commands and GitHub Actions integration |
| internal/testutil/acc/skip.go | Added access token detection and skip helper function |
| internal/testutil/acc/pre_check.go | Updated credential validation to include access token as valid auth method |
| internal/testutil/acc/factory.go | Added access token to provider configuration |
| internal/service/project/resource_project_test.go | Added access token skip for Gov test |
| internal/service/project/resource_project_migration_test.go | Added access token skip for Gov migration test |
| internal/provider/provider_authentication_test.go | Added access token skips for credential-specific tests |
| internal/config/service_account.go | Added TODO comment (temporary marker) |
| Makefile | Updated make targets to use new access-token tool commands |
| .github/workflows/code-health.yml | Removed needs dependency from acceptance tests workflow |
| .github/workflows/acceptance-tests-runner.yml | Added dedicated SA migration test jobs and token lifecycle management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I really like this workaround.
| MONGODB_ATLAS_PUBLIC_KEY: "" | ||
| MONGODB_ATLAS_PRIVATE_KEY: "" | ||
| MONGODB_ATLAS_CLIENT_ID: "" | ||
| MONGODB_ATLAS_CLIENT_SECRET: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explicitly set these to empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes because they're set here in the global workflow environment, so needed to override them:
| MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }} |
and in tests we verify that they is only one credentials mechanism to avoid issues:
| if authCount > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, ty!
Description
Adjust migration tests with SA and access token
Link to any related issue(s): CLOUDP-352095
Type of change:
Required Checklist:
Further comments