Skip to content

Conversation

@adreed-msft
Copy link
Member

@adreed-msft adreed-msft commented Nov 5, 2025

Description

  • Feature / Bug Fix: Enables OAuth-only setup of the E2E testing framework (no account key copying required)

Type of Change

  • Bug fix
  • New feature (Testing Framework)
  • Documentation update required
  • Code quality improvement
  • Other (describe):

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.

Copilot AI review requested due to automatic review settings November 5, 2025 18:17
@adreed-msft adreed-msft changed the title Adreed/e2e framework auth Enable OAuth-only/Acct Key Lookup on the testing framework for static resources Nov 5, 2025
Copy link
Contributor

Copilot AI left a 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 err from line 215 is not checked before returning the service manager, unlike the Blob and File cases which have a.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{
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
tok, err := o.GetToken(ctx, policy.TokenRequestOptions{
tok, err := o.GetToken(context.Background(), policy.TokenRequestOptions{

Copilot uses AI. Check for mistakes.
var client *blobfsservice.Client
if acct.InternalAccountKey != "" {
var sharedKey *blobfscommon.SharedKeyCredential
sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey)
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey)
sharedKey, err = blobfscommon.NewSharedKeyCredential(acct.InternalAccountName, acct.InternalAccountKey)
a.NoError("Create BlobFS shared key", err)

Copilot uses AI. Check for mistakes.
a.NoError("Create BlobFS client", err)
} else {
client, err = blobfsservice.NewClient(uri, PrimaryOAuthCache, nil)
}
Copy link

Copilot AI Nov 5, 2025

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.

Suggested change
}
a.NoError("Create BlobFS client", err)

Copilot uses AI. Check for mistakes.
AccountName: DerefOrDefault(opts.CustomName, "azcopynewe2e") + uuidSegments[len(uuidSegments)-1],
}
accountARMClient := CommonARMResourceGroup.
NewStorageAccountARMClient(DerefOrDefault(opts.CustomName, "azcopynewe2e") + uuidSegments[len(uuidSegments)-1])
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants