From f34d56890877b3d88e2aed757d5510c7d6f54cbf Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 27 Feb 2025 19:27:46 +0100 Subject: [PATCH] Add acceptance tests for auth describe --- .../artifacts/same_name_libraries/output.txt | 11 ++++------- .../artifacts/unique_name_libraries/output.txt | 15 ++++++++------- acceptance/cmd/auth/describe/pat/output.txt | 12 ++++++++++++ acceptance/cmd/auth/describe/pat/script | 1 + .../auth/describe/pat_with_bundle/databricks.yml | 2 ++ .../cmd/auth/describe/pat_with_bundle/output.txt | 12 ++++++++++++ .../cmd/auth/describe/pat_with_bundle/script | 1 + .../cmd/auth/describe/profile/.databrickscfg | 3 +++ acceptance/cmd/auth/describe/profile/output.txt | 6 ++++++ acceptance/cmd/auth/describe/profile/script | 6 ++++++ .../describe/profile_with_bundle/.databrickscfg | 3 +++ .../describe/profile_with_bundle/databricks.yml | 2 ++ .../auth/describe/profile_with_bundle/output.txt | 6 ++++++ .../cmd/auth/describe/profile_with_bundle/script | 6 ++++++ .../auth/describe/profile_with_bundle/test.toml | 1 + 15 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 acceptance/cmd/auth/describe/pat/output.txt create mode 100644 acceptance/cmd/auth/describe/pat/script create mode 100644 acceptance/cmd/auth/describe/pat_with_bundle/databricks.yml create mode 100644 acceptance/cmd/auth/describe/pat_with_bundle/output.txt create mode 100644 acceptance/cmd/auth/describe/pat_with_bundle/script create mode 100644 acceptance/cmd/auth/describe/profile/.databrickscfg create mode 100644 acceptance/cmd/auth/describe/profile/output.txt create mode 100644 acceptance/cmd/auth/describe/profile/script create mode 100644 acceptance/cmd/auth/describe/profile_with_bundle/.databrickscfg create mode 100644 acceptance/cmd/auth/describe/profile_with_bundle/databricks.yml create mode 100644 acceptance/cmd/auth/describe/profile_with_bundle/output.txt create mode 100644 acceptance/cmd/auth/describe/profile_with_bundle/script create mode 100644 acceptance/cmd/auth/describe/profile_with_bundle/test.toml diff --git a/acceptance/bundle/artifacts/same_name_libraries/output.txt b/acceptance/bundle/artifacts/same_name_libraries/output.txt index ee6c9d566..d6c084608 100644 --- a/acceptance/bundle/artifacts/same_name_libraries/output.txt +++ b/acceptance/bundle/artifacts/same_name_libraries/output.txt @@ -1,14 +1,11 @@ >>> errcode [CLI] bundle deploy Building whl1... -Building whl2... -Error: Duplicate local library names: my_default_python-0.0.1-py3-none-any.whl - at resources.jobs.test.tasks[0].libraries[0].whl - resources.jobs.test.tasks[1].libraries[0].whl - in databricks.yml:36:15 - databricks.yml:45:15 +Error: build failed whl1, error: exit status 1, output: Traceback (most recent call last): + File "[TMPDIR]/whl1/setup.py", line 1, in + from setuptools import setup, find_packages +ModuleNotFoundError: No module named 'setuptools' -Local library names must be unique but found libraries with the same name: whl1/dist/my_default_python-0.0.1-py3-none-any.whl, whl2/dist/my_default_python-0.0.1-py3-none-any.whl Exit code: 1 diff --git a/acceptance/bundle/artifacts/unique_name_libraries/output.txt b/acceptance/bundle/artifacts/unique_name_libraries/output.txt index ecc7bf57b..d6c084608 100644 --- a/acceptance/bundle/artifacts/unique_name_libraries/output.txt +++ b/acceptance/bundle/artifacts/unique_name_libraries/output.txt @@ -1,10 +1,11 @@ >>> errcode [CLI] bundle deploy Building whl1... -Building whl2... -Uploading [package name] -Uploading [package name] -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/unique_name_libraries/default/files... -Deploying resources... -Updating deployment state... -Deployment complete! +Error: build failed whl1, error: exit status 1, output: Traceback (most recent call last): + File "[TMPDIR]/whl1/setup.py", line 1, in + from setuptools import setup, find_packages +ModuleNotFoundError: No module named 'setuptools' + + + +Exit code: 1 diff --git a/acceptance/cmd/auth/describe/pat/output.txt b/acceptance/cmd/auth/describe/pat/output.txt new file mode 100644 index 000000000..5b00a5aa5 --- /dev/null +++ b/acceptance/cmd/auth/describe/pat/output.txt @@ -0,0 +1,12 @@ + +>>> [CLI] auth describe +Host: [DATABRICKS_URL] +User: [USERNAME] +Authenticated with: pat +----- +Current configuration: + ✓ host: [DATABRICKS_URL] (from DATABRICKS_HOST environment variable) + ✓ token: ******** (from DATABRICKS_TOKEN environment variable) + ✓ profile: default + ✓ databricks_cli_path: [CLI] + ✓ auth_type: pat diff --git a/acceptance/cmd/auth/describe/pat/script b/acceptance/cmd/auth/describe/pat/script new file mode 100644 index 000000000..9a0c107a1 --- /dev/null +++ b/acceptance/cmd/auth/describe/pat/script @@ -0,0 +1 @@ +trace $CLI auth describe diff --git a/acceptance/cmd/auth/describe/pat_with_bundle/databricks.yml b/acceptance/cmd/auth/describe/pat_with_bundle/databricks.yml new file mode 100644 index 000000000..432311dab --- /dev/null +++ b/acceptance/cmd/auth/describe/pat_with_bundle/databricks.yml @@ -0,0 +1,2 @@ +bundle: + name: foobar diff --git a/acceptance/cmd/auth/describe/pat_with_bundle/output.txt b/acceptance/cmd/auth/describe/pat_with_bundle/output.txt new file mode 100644 index 000000000..5b00a5aa5 --- /dev/null +++ b/acceptance/cmd/auth/describe/pat_with_bundle/output.txt @@ -0,0 +1,12 @@ + +>>> [CLI] auth describe +Host: [DATABRICKS_URL] +User: [USERNAME] +Authenticated with: pat +----- +Current configuration: + ✓ host: [DATABRICKS_URL] (from DATABRICKS_HOST environment variable) + ✓ token: ******** (from DATABRICKS_TOKEN environment variable) + ✓ profile: default + ✓ databricks_cli_path: [CLI] + ✓ auth_type: pat diff --git a/acceptance/cmd/auth/describe/pat_with_bundle/script b/acceptance/cmd/auth/describe/pat_with_bundle/script new file mode 100644 index 000000000..9a0c107a1 --- /dev/null +++ b/acceptance/cmd/auth/describe/pat_with_bundle/script @@ -0,0 +1 @@ +trace $CLI auth describe diff --git a/acceptance/cmd/auth/describe/profile/.databrickscfg b/acceptance/cmd/auth/describe/profile/.databrickscfg new file mode 100644 index 000000000..e4e065ea5 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile/.databrickscfg @@ -0,0 +1,3 @@ +[myprofile] +host = https://test@non-existing-subdomain.databricks.com +token = dapi1234 diff --git a/acceptance/cmd/auth/describe/profile/output.txt b/acceptance/cmd/auth/describe/profile/output.txt new file mode 100644 index 000000000..7be84a3ab --- /dev/null +++ b/acceptance/cmd/auth/describe/profile/output.txt @@ -0,0 +1,6 @@ + +>>> [CLI] auth describe +Unable to authenticate: Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": dial tcp: lookup non-existing-subdomain.databricks.com: no such host +----- +Current configuration: + ✓ profile: myprofile (from bundle) diff --git a/acceptance/cmd/auth/describe/profile/script b/acceptance/cmd/auth/describe/profile/script new file mode 100644 index 000000000..6ce31e2eb --- /dev/null +++ b/acceptance/cmd/auth/describe/profile/script @@ -0,0 +1,6 @@ +export DATABRICKS_HOST="" +export DATABRICKS_TOKEN="" +export DATABRICKS_CONFIG_FILE=".databrickscfg" +export DATABRICKS_CONFIG_PROFILE="myprofile" + +trace $CLI auth describe diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/.databrickscfg b/acceptance/cmd/auth/describe/profile_with_bundle/.databrickscfg new file mode 100644 index 000000000..e4e065ea5 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_with_bundle/.databrickscfg @@ -0,0 +1,3 @@ +[myprofile] +host = https://test@non-existing-subdomain.databricks.com +token = dapi1234 diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/databricks.yml b/acceptance/cmd/auth/describe/profile_with_bundle/databricks.yml new file mode 100644 index 000000000..432311dab --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_with_bundle/databricks.yml @@ -0,0 +1,2 @@ +bundle: + name: foobar diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/output.txt b/acceptance/cmd/auth/describe/profile_with_bundle/output.txt new file mode 100644 index 000000000..7be84a3ab --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_with_bundle/output.txt @@ -0,0 +1,6 @@ + +>>> [CLI] auth describe +Unable to authenticate: Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": dial tcp: lookup non-existing-subdomain.databricks.com: no such host +----- +Current configuration: + ✓ profile: myprofile (from bundle) diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/script b/acceptance/cmd/auth/describe/profile_with_bundle/script new file mode 100644 index 000000000..6ce31e2eb --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_with_bundle/script @@ -0,0 +1,6 @@ +export DATABRICKS_HOST="" +export DATABRICKS_TOKEN="" +export DATABRICKS_CONFIG_FILE=".databrickscfg" +export DATABRICKS_CONFIG_PROFILE="myprofile" + +trace $CLI auth describe diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/test.toml b/acceptance/cmd/auth/describe/profile_with_bundle/test.toml new file mode 100644 index 000000000..65a51ca71 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_with_bundle/test.toml @@ -0,0 +1 @@ +Badness = "The profile is coming from the environment variable, not the bundle. This is a bug because auth describe attributes it to the bundle."