Skip to content

Add parametrized unit tests for auth types across host profiles#1627

Merged
hectorcast-db merged 3 commits intomainfrom
hector/auth-profiles-tests
Apr 15, 2026
Merged

Add parametrized unit tests for auth types across host profiles#1627
hectorcast-db merged 3 commits intomainfrom
hector/auth-profiles-tests

Conversation

@hectorcast-db
Copy link
Copy Markdown
Contributor

Summary

  • Adds config/auth_profiles_test.go with 165 parametrized subtests covering 12 auth types across 6 host profiles (LW, NW, LA, NA, SPOGW, SPOGA) on AWS, Azure, and GCP
  • Mirrors databricks/databricks-sdk-py#1357 for the Go SDK
  • Uses HostMetadataResolver to inject host metadata, exercising the full production resolution path including DiscoveryURL population
  • Uses Loaders: []Loader{noopLoader} to isolate tests from environment variable contamination

Profiles tested

Profile Description Derivation
LW Legacy Workspace Baseline
NW New Workspace LW + account_id + workspace_id
LA Legacy Account Baseline
NA New Account Structurally same as LA
SPOGW SPOG workspace Unified host + account_id + workspace_id
SPOGA SPOG account Unified host + account_id

Auth types covered

pat, basic, oauth-m2m, databricks-cli, github-oidc, env-oidc, file-oidc, metadata-service, azure-client-secret, azure-cli, github-oidc-azure, azure-devops-oidc

Not covered (with rationale)

  • google-credentials, google-id: GoogleCredentials.Configure and GoogleDefaultCredentials.Configure call Google SDK functions (idtoken.NewTokenSource, impersonate.IDTokenSource) that parse real crypto keys and make HTTP calls internally. No seam exists to inject mocks via HTTPTransport without refactoring production code.

NO_CHANGELOG=true

Test plan

  • All 165 new subtests pass locally (go test ./config/ -run TestProfileAuth)
  • Existing tests unaffected (go test ./config/ passes)

This pull request was AI-assisted by Isaac.

Tests that each auth type resolves correctly on every applicable host
profile (LW, NW, LA, NA, SPOGW, SPOGA) across AWS, Azure, and GCP
clouds. Covers pat, basic, oauth-m2m, databricks-cli, github-oidc,
env-oidc, file-oidc, metadata-service, azure-client-secret, azure-cli,
github-oidc-azure, and azure-devops-oidc (165 subtests total).

Co-authored-by: Isaac
Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
Copy link
Copy Markdown
Contributor

@tejaskochar-db tejaskochar-db left a comment

Choose a reason for hiding this comment

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

Tests look fine to me, some nits

Comment thread config/auth_profiles_test.go Outdated
Comment thread config/auth_profiles_test.go Outdated
Comment thread config/auth_profiles_test.go Outdated
- Use existing noopLoader{} from api_client.go instead of defining
  a duplicate noopProfileLoader
- Remove unused accountProfiles; compute workspaceProfiles locally
  in the one test that needs it (MetadataService)
- Refactor TestProfileAuth_AzureCli to use profileConfig(p) like
  all other tests

Co-authored-by: Isaac
Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
@github-actions
Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1627
  • Commit SHA: e4e21821df0ebbf575b9e1197e4cebdb66bcbfd9

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 329c6ed Apr 15, 2026
11 of 13 checks passed
@hectorcast-db hectorcast-db deleted the hector/auth-profiles-tests branch April 15, 2026 12:07
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.

2 participants