From 4ddfb5e40a407ae505296a76eee41c54cd62415b Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Tue, 19 May 2026 15:07:22 +0200 Subject: [PATCH] acceptance: use templates for bundle_default_profile scenarios Replace inline heredocs and per-scenario subdirectories (./bundle-with-host, ./bundle-with-profile) with three committed template files: databricks.yml.{no-host,with-host,with-profile}.tmpl. The script copies (or envsubsts, for the host-pinned template) the active template into databricks.yml before each phase, so the active bundle is always at the test root. Follows pietern's suggestion in #5214. Co-authored-by: Isaac --- ...bricks.yml => databricks.yml.no-host.tmpl} | 0 .../databricks.yml.with-host.tmpl | 5 ++++ .../databricks.yml.with-profile.tmpl | 5 ++++ acceptance/auth/bundle_default_profile/script | 26 +++++-------------- .../auth/bundle_default_profile/test.toml | 3 +-- 5 files changed, 17 insertions(+), 22 deletions(-) rename acceptance/auth/bundle_default_profile/{databricks.yml => databricks.yml.no-host.tmpl} (100%) create mode 100644 acceptance/auth/bundle_default_profile/databricks.yml.with-host.tmpl create mode 100644 acceptance/auth/bundle_default_profile/databricks.yml.with-profile.tmpl diff --git a/acceptance/auth/bundle_default_profile/databricks.yml b/acceptance/auth/bundle_default_profile/databricks.yml.no-host.tmpl similarity index 100% rename from acceptance/auth/bundle_default_profile/databricks.yml rename to acceptance/auth/bundle_default_profile/databricks.yml.no-host.tmpl diff --git a/acceptance/auth/bundle_default_profile/databricks.yml.with-host.tmpl b/acceptance/auth/bundle_default_profile/databricks.yml.with-host.tmpl new file mode 100644 index 00000000000..4c2f0748389 --- /dev/null +++ b/acceptance/auth/bundle_default_profile/databricks.yml.with-host.tmpl @@ -0,0 +1,5 @@ +bundle: + name: bundle-with-host + +workspace: + host: $DATABRICKS_HOST diff --git a/acceptance/auth/bundle_default_profile/databricks.yml.with-profile.tmpl b/acceptance/auth/bundle_default_profile/databricks.yml.with-profile.tmpl new file mode 100644 index 00000000000..18e719f0ea8 --- /dev/null +++ b/acceptance/auth/bundle_default_profile/databricks.yml.with-profile.tmpl @@ -0,0 +1,5 @@ +bundle: + name: bundle-with-profile + +workspace: + profile: other diff --git a/acceptance/auth/bundle_default_profile/script b/acceptance/auth/bundle_default_profile/script index 6c54b13c78f..793176c4b52 100644 --- a/acceptance/auth/bundle_default_profile/script +++ b/acceptance/auth/bundle_default_profile/script @@ -20,9 +20,11 @@ unset DATABRICKS_HOST unset DATABRICKS_TOKEN unset DATABRICKS_CONFIG_PROFILE +cp databricks.yml.no-host.tmpl databricks.yml title "Bundle without workspace.host: default_profile is honored\n" trace $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}' +cp databricks.yml.no-host.tmpl databricks.yml title "--profile overrides default_profile (negative case)\n" trace errcode $CLI bundle validate -p other -o json | jq '{host: .workspace.host, profile: .workspace.profile}' @@ -30,29 +32,13 @@ trace errcode $CLI bundle validate -p other -o json | jq '{host: .workspace.host # configureProfile must NOT apply default_profile here, because that would # silently route the user to a profile pointing at a different host than the # bundle declares. -mkdir -p ./bundle-with-host -cat > ./bundle-with-host/databricks.yml < databricks.yml title "Bundle with workspace.host: default_profile is NOT applied\n" -(cd ./bundle-with-host && trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}') +trace errcode $CLI bundle validate -o json | jq '{host: .workspace.host, profile: .workspace.profile}' # Switch to a bundle that pins workspace.profile but no host. The pinned # profile must win over default_profile — configureProfile's guard skips # default_profile when workspace.profile is already set. -mkdir -p ./bundle-with-profile -cat > ./bundle-with-profile/databricks.yml <