From f0d1dc56c8c448ef25b49c09023b06a52a185f23 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 3 Mar 2025 17:40:04 +0100 Subject: [PATCH] fix replacement --- .../bundle/exec/databricks-cli/basic/out.requests.txt | 2 +- acceptance/bundle/exec/databricks-cli/basic/script | 2 +- .../exec/databricks-cli/profile-is-passed/databricks.yml | 2 ++ .../bundle/exec/databricks-cli/profile-is-passed/output.txt | 3 +++ .../bundle/exec/databricks-cli/profile-is-passed/script | 0 acceptance/bundle/exec/databricks-cli/test.toml | 6 ++++++ cmd/bundle/exec.go | 2 +- 7 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 acceptance/bundle/exec/databricks-cli/profile-is-passed/databricks.yml create mode 100644 acceptance/bundle/exec/databricks-cli/profile-is-passed/output.txt create mode 100644 acceptance/bundle/exec/databricks-cli/profile-is-passed/script diff --git a/acceptance/bundle/exec/databricks-cli/basic/out.requests.txt b/acceptance/bundle/exec/databricks-cli/basic/out.requests.txt index 10a364e97..26efbbb08 100644 --- a/acceptance/bundle/exec/databricks-cli/basic/out.requests.txt +++ b/acceptance/bundle/exec/databricks-cli/basic/out.requests.txt @@ -23,7 +23,7 @@ { "headers": { "Authorization": [ - "Basic Y2xpZW50X2lkOmNsaWVudC1zZWNyZXQ=" + "Basic [ENCODED_AUTH]" ] }, "method": "POST", diff --git a/acceptance/bundle/exec/databricks-cli/basic/script b/acceptance/bundle/exec/databricks-cli/basic/script index 3a3c5efe9..1f44239df 100644 --- a/acceptance/bundle/exec/databricks-cli/basic/script +++ b/acceptance/bundle/exec/databricks-cli/basic/script @@ -11,5 +11,5 @@ trace errcode $CLI bundle exec -t pat -- databricks current-user me -t oauth # Explicitly select oauth target export DATABRICKS_TOKEN="" -export DATABRICKS_CLIENT_SECRET="client-secret" +export DATABRICKS_CLIENT_SECRET="client_secret" trace $CLI bundle exec -t oauth -- databricks current-user me diff --git a/acceptance/bundle/exec/databricks-cli/profile-is-passed/databricks.yml b/acceptance/bundle/exec/databricks-cli/profile-is-passed/databricks.yml new file mode 100644 index 000000000..432311dab --- /dev/null +++ b/acceptance/bundle/exec/databricks-cli/profile-is-passed/databricks.yml @@ -0,0 +1,2 @@ +bundle: + name: foobar diff --git a/acceptance/bundle/exec/databricks-cli/profile-is-passed/output.txt b/acceptance/bundle/exec/databricks-cli/profile-is-passed/output.txt new file mode 100644 index 000000000..a258c7073 --- /dev/null +++ b/acceptance/bundle/exec/databricks-cli/profile-is-passed/output.txt @@ -0,0 +1,3 @@ +script: line 64: syntax error near unexpected token `)' + +Exit code: 2 diff --git a/acceptance/bundle/exec/databricks-cli/profile-is-passed/script b/acceptance/bundle/exec/databricks-cli/profile-is-passed/script new file mode 100644 index 000000000..e69de29bb diff --git a/acceptance/bundle/exec/databricks-cli/test.toml b/acceptance/bundle/exec/databricks-cli/test.toml index 373138e0c..24cf889ec 100644 --- a/acceptance/bundle/exec/databricks-cli/test.toml +++ b/acceptance/bundle/exec/databricks-cli/test.toml @@ -1,2 +1,8 @@ RecordRequests = true IncludeRequestHeaders = ["Authorization"] + +# "client_id:client_secret" in base64 is Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=, expect to +# see this in Authorization header +[[Repls]] +Old = "Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=" +New = "[ENCODED_AUTH]" diff --git a/cmd/bundle/exec.go b/cmd/bundle/exec.go index 4faac4039..5ec6a0d28 100644 --- a/cmd/bundle/exec.go +++ b/cmd/bundle/exec.go @@ -33,7 +33,7 @@ import ( // TODO: Add acceptance test that flags are indeed not parsed by the exec command and // instead are parsed by the child command. -// # TODO: Table test casing the target permutations +// # TODO: Table test casing the profile flag permutations func newExecCommand() *cobra.Command { execCmd := &cobra.Command{