Skip to content

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

Merged
hectorcast-db merged 3 commits intomainfrom
stack/unit-test-auth-profiles
Apr 13, 2026
Merged

Add parametrized unit tests for auth types across host profiles#1357
hectorcast-db merged 3 commits intomainfrom
stack/unit-test-auth-profiles

Conversation

@hectorcast-db
Copy link
Copy Markdown
Contributor

@hectorcast-db hectorcast-db commented Mar 24, 2026

Summary

  • Adds tests/test_auth_profiles.py with 90 parametrized unit tests covering 16 auth types across 6 host profiles (LW, NW, LA, NA, SPOGW, SPOGA)
  • Existing unit tests cover Legacy Workspace (LW) and Legacy Account (LA) — we assume those are correct and working, and build on them to verify that auth resolution also works for the remaining profiles (NW, NA, SPOGW, SPOGA)
  • SPOG profiles use account-level OIDC endpoints with {account_id} template, matching real SPOG host metadata behavior
  • Environment-locked types (runtime, runtime-oauth, model-serving, metadata-service) only tested on workspace profiles — they never run at account level. A separate PR will be created to investigate support with SPOG.
  • Cloud-specific auth types use appropriate host patterns (Azure for azure-, GCP for google-)

Profiles tested

Profile Description Derivation
LW Legacy Workspace Baseline (existing tests)
NW New Workspace LW + account_id + workspace_id
LA Legacy Account Baseline (existing tests)
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, env-oidc, file-oidc, github-oidc, azure-client-secret, azure-cli, github-oidc-azure, azure-devops-oidc, google-credentials, google-id, metadata-service, runtime, runtime-oauth, model-serving

Test plan

  • All 90 new tests pass locally
  • Existing tests unaffected (197 total pass with test_auth.py + test_config.py + test_auth_profiles.py)
  • CI passes

NO_CHANGELOG=true

This pull request was AI-assisted by Isaac.

Existing unit tests cover Legacy Workspace (LW) and Legacy Account (LA)
profiles. This assumes those are correct and working, and builds on them
to verify that auth resolution also works for the remaining profiles:

- NW (New Workspace): LW + account_id + workspace_id
- NA (New Account): structurally same as LA
- SPOGW (SPOG workspace): unified host + account_id + workspace_id
- SPOGA (SPOG account): unified host + account_id

SPOG profiles use account-level OIDC endpoints (with {account_id}
template), matching real SPOG host metadata behavior.

90 tests covering 16 auth types. Cloud-specific auth types use
appropriate host patterns (Azure for azure-*, GCP for google-*).
Environment-locked types (runtime, runtime-oauth, model-serving,
metadata-service) are only tested on workspace profiles since they
never run at account level. external-browser is excluded (requires
interactive browser flow).

Co-authored-by: Isaac
@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-py

Inputs:

  • PR number: 1357
  • Commit SHA: 7c7b859912edbeb8ec69f996dc76fe6911df617a

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit 81e2a23 Apr 13, 2026
12 of 13 checks passed
@hectorcast-db hectorcast-db deleted the stack/unit-test-auth-profiles branch April 13, 2026 11:03
github-merge-queue bot pushed a commit to databricks/databricks-sdk-go that referenced this pull request Apr 15, 2026
## 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](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

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

This pull request was AI-assisted by Isaac.

---------

Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
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