From 95e9d47acdd91ae6afc991a9e628983f2ff7f74e Mon Sep 17 00:00:00 2001
From: Denis Bilenko <denis.bilenko@databricks.com>
Date: Tue, 28 Jan 2025 15:09:35 +0100
Subject: [PATCH] Fix env_overrides not to use variables in workspace.profile

This does not work when this test is run against cloud.

Needed for https://github.com/databricks/cli/pull/2242
---
 acceptance/bundle/variables/env_overrides/databricks.yml | 7 ++++---
 acceptance/bundle/variables/env_overrides/output.txt     | 3 ++-
 acceptance/bundle/variables/env_overrides/script         | 6 +++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/acceptance/bundle/variables/env_overrides/databricks.yml b/acceptance/bundle/variables/env_overrides/databricks.yml
index 560513bc3..e5fc7fcc4 100644
--- a/acceptance/bundle/variables/env_overrides/databricks.yml
+++ b/acceptance/bundle/variables/env_overrides/databricks.yml
@@ -18,12 +18,13 @@ variables:
     description: variable with lookup
     lookup:
       cluster_policy: wrong-cluster-policy
+
+  result:
+    default: ${var.a} ${var.b}
+
 bundle:
   name: test bundle
 
-workspace:
-  profile: ${var.a} ${var.b}
-
 targets:
   env-with-single-variable-override:
     variables:
diff --git a/acceptance/bundle/variables/env_overrides/output.txt b/acceptance/bundle/variables/env_overrides/output.txt
index 1ee9ef625..06e6e518b 100644
--- a/acceptance/bundle/variables/env_overrides/output.txt
+++ b/acceptance/bundle/variables/env_overrides/output.txt
@@ -36,5 +36,6 @@ Exit code: 1
   "b": "prod-b",
   "d": "4321",
   "e": "1234",
-  "f": "9876"
+  "f": "9876",
+  "result": "default-a prod-b"
 }
diff --git a/acceptance/bundle/variables/env_overrides/script b/acceptance/bundle/variables/env_overrides/script
index 30919fd8a..3965d1564 100644
--- a/acceptance/bundle/variables/env_overrides/script
+++ b/acceptance/bundle/variables/env_overrides/script
@@ -1,6 +1,6 @@
-trace $CLI bundle validate -t env-with-single-variable-override -o json | jq .workspace.profile
-trace $CLI bundle validate -t env-with-two-variable-overrides -o json | jq .workspace.profile
-trace BUNDLE_VAR_b=env-var-b $CLI bundle validate -t env-with-two-variable-overrides -o json | jq .workspace.profile
+trace $CLI bundle validate -t env-with-single-variable-override -o json | jq .variables.result.value
+trace $CLI bundle validate -t env-with-two-variable-overrides -o json | jq .variables.result.value
+trace BUNDLE_VAR_b=env-var-b $CLI bundle validate -t env-with-two-variable-overrides -o json | jq .variables.result.value
 trace errcode $CLI bundle validate -t env-missing-a-required-variable-assignment
 trace errcode $CLI bundle validate -t env-using-an-undefined-variable
 trace $CLI bundle validate -t env-overrides-lookup -o json | jq '.variables | map_values(.value)'