Skip to content

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

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

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

Conversation

@pietern
Copy link
Contributor

@pietern pietern commented Mar 11, 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

  • 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 pietern temporarily deployed to test-trigger-is March 11, 2026 16:45 — with GitHub Actions Inactive
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
Copy link
Collaborator

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

Commit: 2cee048

Run: 22963866461

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 8 7 268 781 7:39
🔄​ aws windows 2 6 7 270 779 5:50
🔄​ aws-ucws linux 2 6 7 365 696 8:26
🔄​ aws-ucws windows 2 7 7 366 694 7:41
💚​ azure linux 2 9 271 779 5:56
💚​ azure windows 2 9 273 777 5:34
🔄​ azure-ucws linux 2 1 9 369 692 10:04
🔄​ azure-ucws windows 2 1 9 371 690 7:44
💚​ gcp linux 2 9 267 782 5:51
💚​ gcp windows 2 9 269 780 4:50
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp 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):
duration env testname
3:58 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:48 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:43 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:32 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:30 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:29 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:26 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:21 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:15 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:12 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:12 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:08 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:07 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:06 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:04 aws-ucws linux TestAccept/ssh/connect-serverless-gpu
2:59 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:24 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:22 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:17 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:15 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:13 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@pietern pietern enabled auto-merge March 11, 2026 19:32
github-merge-queue bot 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 queue Mar 12, 2026
Merged via the queue into main with commit 3d4eede Mar 12, 2026
41 of 43 checks passed
@pietern pietern deleted the cmd-root-azure branch March 12, 2026 20:10
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.

3 participants