-
Notifications
You must be signed in to change notification settings - Fork 253
Enable OAuth-only/Acct Key Lookup on the testing framework for static resources #3275
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
base: main
Are you sure you want to change the base?
Conversation
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 adds support for OAuth-based authentication as a fallback mechanism for Azure storage accounts in the e2e testing framework. When account keys are unavailable or not provided, the system can now authenticate using OAuth tokens, enabling more flexible test configurations.
- Adds
AvailableAuthTypes()method to account resource managers to query supported authentication types - Implements account key lookup functionality via Azure Resource Manager for static storage accounts
- Refactors OAuth cache to support multi-scope token management with UUID-based tracking
- Updates ARM client architecture to use a ParentSubject pattern for better type safety
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| e2etest/zt_newe2e_basic_functionality_test.go | Extracts source location to variable to avoid duplicate resolution calls |
| e2etest/stress_generators/acct_rm.go | Implements AvailableAuthTypes for OAuth account manager and fixes field naming |
| e2etest/newe2e_task_runazcopy.go | Adds authentication type compatibility checking with fallback logic |
| e2etest/newe2e_resource_managers_file.go | Renames Llocation field to InternalLocation for consistency |
| e2etest/newe2e_resource_manager_mock.go | Adds AvailableAuthTypes stub for mock account manager |
| e2etest/newe2e_resource_manager_interface.go | Adds AvailableAuthTypes to AccountResourceManager interface |
| e2etest/newe2e_resource_manager_azstorage.go | Implements OAuth fallback for client creation and adds AvailableAuthTypes logic |
| e2etest/newe2e_oauth_cache.go | Refactors token caching to support multiple scopes with UUID-based tracking |
| e2etest/newe2e_generic_wrangling.go | Adds list comparison utility functions |
| e2etest/newe2e_config.go | Makes account keys optional and adds account key lookup configuration |
| e2etest/newe2e_arm_test_hooks.go | Updates ARM client setup to support static resources with OAuth |
| e2etest/newe2e_arm_subscription.go | Refactors to use ParentSubject pattern and adds helper methods |
| e2etest/newe2e_arm_storage_account.go | Updates to use ParentSubject pattern |
| e2etest/newe2e_arm_resource_group.go | Updates to use ParentSubject pattern and adds factory methods |
| e2etest/newe2e_arm_requests.go | Moves common ARM request logic to central location |
| e2etest/newe2e_arm_managed_disk.go | Updates to use ParentSubject pattern |
| e2etest/newe2e_arm_interfaces.go | Defines new ARM subject interfaces and ParentSubject type |
| e2etest/newe2e_arm_client.go | Refactors to use new interface pattern and adds factory method |
| e2etest/newe2e_account_registry.go | Implements account key lookup and OAuth fallback during registration |
Comments suppressed due to low confidence (2)
e2etest/newe2e_resource_manager_azstorage.go:1
- Missing error check for the OAuth-based BlobFS client creation. The error
errfrom line 215 is not checked before returning the service manager, unlike the Blob and File cases which havea.NoError(\"Create client\", err)checks.
package e2etest
e2etest/newe2e_arm_requests.go:90
- This definition of err is never used.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| func (o *OAuthCache) GetAccessToken(scope string) (*AzCoreAccessToken, error) { | ||
| // at this point, operates on backwards compat | ||
| tok, err := o.GetToken(ctx, policy.TokenRequestOptions{ |
Copilot
AI
Nov 5, 2025
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.
The variable ctx is used but not defined in this file. It appears to be a package-level variable from helpers.go. Either pass context.Context as a parameter to GetAccessToken, or use context.Background() directly here.
| tok, err := o.GetToken(ctx, policy.TokenRequestOptions{ | |
| tok, err := o.GetToken(context.Background(), policy.TokenRequestOptions{ |
| var client *blobfsservice.Client | ||
| if acct.InternalAccountKey != "" { | ||
| var sharedKey *blobfscommon.SharedKeyCredential | ||
| sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey) |
Copilot
AI
Nov 5, 2025
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.
This definition of err is never used.
| sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey) | |
| sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey) | |
| a.NoError("Create BlobFS shared key", err) |
| a.NoError("Create BlobFS client", err) | ||
| } else { | ||
| client, err = blobfsservice.NewClient(uri, PrimaryOAuthCache, nil) | ||
| } |
Copilot
AI
Nov 5, 2025
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.
This definition of err is never used.
| } | |
| a.NoError("Create BlobFS client", err) |
| AccountName: DerefOrDefault(opts.CustomName, "azcopynewe2e") + uuidSegments[len(uuidSegments)-1], | ||
| } | ||
| accountARMClient := CommonARMResourceGroup. | ||
| NewStorageAccountARMClient(DerefOrDefault(opts.CustomName, "azcopynewe2e") + uuidSegments[len(uuidSegments)-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.
nitpic: Are we reducing flexibility by using a factory method to create the ARM client instead of using the struct?
Description
Type of Change
How Has This Been Tested?
Manually. This feature is only enabled for static resources on the testing framework, so it shouldn't negatively affect the core product, or automated runs of the test suite.
Some test breaks should be expected for OAuth-only/fallback mode, since some tests were designed with the use of public access and/or account keys in mind. Lookup mode is available for that.