Skip to content

Prevent SDK from invoking az during cmd/root tests - #4710

Merged
pietern merged 1 commit into
mainfrom
cmd-root-azure
Mar 12, 2026
Merged

Prevent SDK from invoking az during cmd/root tests#4710
pietern merged 1 commit into
mainfrom
cmd-root-azure

Conversation

@pietern

Copy link
Copy Markdown
Contributor

Summary

  • Clear PATH in cmd/root auth tests to prevent the Go SDK (v0.117.0+) from shelling out to az account show during credential resolution
  • For TestBundleConfigureDefault, restrict PATH to system directories instead of clearing it fully — the bundle loader's script hook mutator currently requires a shell to be present even when no scripts are configured (fixing that separately)
  • Normalize existing PATH="/nothing" in prompt tests to PATH=""

The SDK upgrade to v0.117.0 (databricks/databricks-sdk-go#1505, bumped in #4631) removed per-strategy cloud guards from Azure CLI credentials, causing az to be probed on all platforms regardless of the configured host. This added ~0.5–2.5s per affected test and wrote .azure/ cache files into the source tree.

Verified on macOS and Windows.

Test plan

  • go test -count=1 ./cmd/root passes on macOS (1.2s, down from 5.2s)
  • go test -count=1 ./cmd/root passes on Windows (0.19s)
  • No .azure/ or Library/ directories created in cmd/root/

🤖 Generated with Claude Code

The SDK upgrade to v0.117.0 changed credential resolution such that
Azure CLI auth is attempted even for non-Azure hosts. This causes
`az account show` to be invoked during tests that go through auth
resolution, adding ~0.5-2.5s per test and writing `.azure/` cache
files into the source tree.
Clear PATH in auth tests to prevent the SDK from finding `az`.
For the bundle loader test, restrict PATH to system directories
instead since the bundle loader currently requires a shell to be
available (fixing that separately).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pietern added a commit that referenced this pull request Mar 11, 2026
Move the empty command check to the top of `Apply` so that
`NewCommandExecutor` (which requires a shell) is not called
when no script hook is configured. This avoids a hard
dependency on a shell being available during bundle
initialization.
Closes#4710
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Commit: 2cee048

Run: 22963866461

Env🔄​flaky💚​RECOVERED🙈​SKIP✅​pass🙈​skipTime
💚​aws linux872687817:39
🔄​aws windows2672707795:50
🔄​aws-ucws linux2673656968:26
🔄​aws-ucws windows2773666947:41
💚​azure linux292717795:56
💚​azure windows292737775:34
🔄​azure-ucws linux21936969210:04
🔄​azure-ucws windows2193716907:44
💚​gcp linux292677825:51
💚​gcp windows292697804:50
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
🔄​TestAccept💚​R🔄​f🔄​f💚​R💚​R💚​R💚​R🔄​f💚​R💚​R
🙈​TestAccept/bundle/resources/permissions🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
🙈​TestAccept/bundle/resources/postgres_branches/basic🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/recreate🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/update_protected🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/without_branch_id🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_endpoints/recreate🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/synced_database_tables/basic🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🔄​TestAccept/ssh/connect-serverless-gpu🙈​s🙈​s✅​p🔄​f🙈​s🙈​s🔄​f🔄​f🙈​s🙈​s
🔄​TestAccept/ssh/connection💚​R🔄​f🔄​f🔄​f💚​R💚​R🔄​f💚​R💚​R💚​R
Top 21 slowest tests (at least 2 minutes):
durationenvtestname
3:58aws-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:48gcp windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:43azure-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:32aws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:30aws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:29aws-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:26aws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:21azure linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:15aws-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:12gcp windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:12gcp linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:08gcp linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:07azure-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:06aws-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:04aws-ucws linuxTestAccept/ssh/connect-serverless-gpu
2:59aws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:24azure-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:22azure windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:17azure-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:15azure windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:13azure linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@pietern
pietern enabled auto-merge March 11, 2026 19:32
github-merge-queueBot pushed a commit that referenced this pull request Mar 12, 2026
## Summary
- Move the empty command check to the top of `script.Apply` so that
`NewCommandExecutor` (which requires a shell to be available) is not
called when no script hook is configured.
- Simplify `executeHook` by passing the resolved command directly
instead of re-fetching it from the bundle.
Found out about this dependency during investigation of #4710.
## Test plan
- [x] Existing unit tests pass
- [x] No new behavior introduced; this is a refactor that reorders
existing checks
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pietern
pietern added this pull request to the merge queueMar 12, 2026
Merged via the queue into main with commit 3d4eedeMar 12, 2026
41 of 43 checks passed
@pietern
pietern deleted the cmd-root-azure branch March 12, 2026 20:10
rauchy pushed a commit that referenced this pull request Mar 17, 2026
## Summary
- Move the empty command check to the top of `script.Apply` so that
`NewCommandExecutor` (which requires a shell to be available) is not
called when no script hook is configured.
- Simplify `executeHook` by passing the resolved command directly
instead of re-fetching it from the bundle.
Found out about this dependency during investigation of #4710.
## Test plan
- [x] Existing unit tests pass
- [x] No new behavior introduced; this is a refactor that reorders
existing checks
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
rauchy pushed a commit that referenced this pull request Mar 17, 2026
## Summary
- Clear `PATH` in `cmd/root` auth tests to prevent the Go SDK
(v0.117.0+) from shelling out to `az account show` during credential
resolution
- For `TestBundleConfigureDefault`, restrict `PATH` to system
directories instead of clearing it fully — the bundle loader's script
hook mutator currently requires a shell to be present even when no
scripts are configured (fixing that separately)
- Normalize existing `PATH="/nothing"` in prompt tests to `PATH=""`
The SDK upgrade to v0.117.0 (databricks/databricks-sdk-go#1505, bumped
in #4631) removed per-strategy cloud guards from Azure CLI credentials,
causing `az` to be probed on all platforms regardless of the configured
host. This added ~0.5–2.5s per affected test and wrote `.azure/` cache
files into the source tree.
Verified on macOS and Windows.
## Test plan
- [x] `go test -count=1 ./cmd/root` passes on macOS (1.2s, down from
5.2s)
- [x] `go test -count=1 ./cmd/root` passes on Windows (0.19s)
- [x] No `.azure/` or `Library/` directories created in `cmd/root/`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
denik pushed a commit that referenced this pull request May 20, 2026
## Summary
- Move the empty command check to the top of `script.Apply` so that
`NewCommandExecutor` (which requires a shell to be available) is not
called when no script hook is configured.
- Simplify `executeHook` by passing the resolved command directly
instead of re-fetching it from the bundle.
Found out about this dependency during investigation of #4710.
## Test plan
- [x] Existing unit tests pass
- [x] No new behavior introduced; this is a refactor that reorders
existing checks
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
denik pushed a commit that referenced this pull request May 20, 2026
## Summary
- Clear `PATH` in `cmd/root` auth tests to prevent the Go SDK
(v0.117.0+) from shelling out to `az account show` during credential
resolution
- For `TestBundleConfigureDefault`, restrict `PATH` to system
directories instead of clearing it fully — the bundle loader's script
hook mutator currently requires a shell to be present even when no
scripts are configured (fixing that separately)
- Normalize existing `PATH="/nothing"` in prompt tests to `PATH=""`
The SDK upgrade to v0.117.0 (databricks/databricks-sdk-go#1505, bumped
in #4631) removed per-strategy cloud guards from Azure CLI credentials,
causing `az` to be probed on all platforms regardless of the configured
host. This added ~0.5–2.5s per affected test and wrote `.azure/` cache
files into the source tree.
Verified on macOS and Windows.
## Test plan
- [x] `go test -count=1 ./cmd/root` passes on macOS (1.2s, down from
5.2s)
- [x] `go test -count=1 ./cmd/root` passes on Windows (0.19s)
- [x] No `.azure/` or `Library/` directories created in `cmd/root/`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

3 participants

@pietern@eng-dev-ecosystem-bot@simonfaltum