diff --git a/Makefile b/Makefile index d30ccef14..e18727934 100644 --- a/Makefile +++ b/Makefile @@ -51,12 +51,12 @@ schema: docs: go run ./bundle/docsgen ./bundle/internal/schema ./bundle/docsgen -INTEGRATION = gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h +INTEGRATION = gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./acceptance ./integration/..." -- -parallel 4 -timeout=2h -integration: +integration: vendor $(INTEGRATION) -integration-short: +integration-short: vendor $(INTEGRATION) -short .PHONY: lint lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short acc-cover acc-showcover docs diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index cad8acf4f..ccdf74bcb 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -209,6 +209,11 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont t.Skipf("Disabled via GOOS.%s setting in %s", runtime.GOOS, configPath) } + cloudEnv := os.Getenv("CLOUD_ENV") + if config.LocalOnly && cloudEnv != "" { + t.Skipf("Disabled via LocalOnly setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv) + } + var tmpDir string var err error if KeepTmp { diff --git a/acceptance/bundle/scripts/test.toml b/acceptance/bundle/scripts/test.toml new file mode 100644 index 000000000..1dbd78681 --- /dev/null +++ b/acceptance/bundle/scripts/test.toml @@ -0,0 +1 @@ +LocalOnly = true # Deployment currently fails when run locally; once that is fixed, remove this setting diff --git a/acceptance/bundle/templates/test.toml b/acceptance/bundle/templates/test.toml new file mode 100644 index 000000000..90539263d --- /dev/null +++ b/acceptance/bundle/templates/test.toml @@ -0,0 +1,2 @@ +# At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on. +LocalOnly = true diff --git a/acceptance/bundle/variables/env_overrides/test.toml b/acceptance/bundle/variables/env_overrides/test.toml new file mode 100644 index 000000000..439c2fab1 --- /dev/null +++ b/acceptance/bundle/variables/env_overrides/test.toml @@ -0,0 +1,2 @@ +# Cloud run fails with Error: failed to resolve cluster-policy: wrong-cluster-policy, err: Policy named 'wrong-cluster-policy' does not exist +LocalOnly = true diff --git a/acceptance/bundle/variables/git-branch/output.txt b/acceptance/bundle/variables/git-branch/output.txt index 5e7664f61..21ed9e7de 100644 --- a/acceptance/bundle/variables/git-branch/output.txt +++ b/acceptance/bundle/variables/git-branch/output.txt @@ -6,7 +6,7 @@ "git": { "actual_branch": "main", "branch": "", - "bundle_root_path": ".", + "bundle_root_path": "." }, "name": "git", "target": "prod", @@ -28,11 +28,6 @@ }, "workspace": { "artifact_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/artifacts", - "current_user": { - "id": "$USER.Id", - "short_name": "$USERNAME", - "userName": "$USERNAME" - }, "file_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/files", "resource_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/resources", "root_path": "/Workspace/Users/$USERNAME/.bundle/git/prod", @@ -56,7 +51,7 @@ Validation OK! "git": { "actual_branch": "main", "branch": "dev-branch", - "bundle_root_path": ".", + "bundle_root_path": "." }, "name": "git", "target": "dev", @@ -78,11 +73,6 @@ Validation OK! }, "workspace": { "artifact_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/artifacts", - "current_user": { - "id": "$USER.Id", - "short_name": "$USERNAME", - "userName": "$USERNAME" - }, "file_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/files", "resource_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/resources", "root_path": "/Workspace/Users/$USERNAME/.bundle/git/dev", diff --git a/acceptance/bundle/variables/git-branch/script b/acceptance/bundle/variables/git-branch/script index aed881f1f..8f99cc01b 100644 --- a/acceptance/bundle/variables/git-branch/script +++ b/acceptance/bundle/variables/git-branch/script @@ -1,6 +1,6 @@ git-repo-init -trace $CLI bundle validate -o json | grep -v '"commit"' +trace $CLI bundle validate -o json | jq 'del(.workspace.current_user, .bundle.git.commit)' trace $CLI bundle validate -trace $CLI bundle validate -o json -t dev | grep -v '"commit"' -trace $CLI bundle validate -t dev | grep -v '"commit"' +trace $CLI bundle validate -o json -t dev | jq 'del(.workspace.current_user, .bundle.git.commit)' +trace $CLI bundle validate -t dev rm -fr .git diff --git a/acceptance/bundle/variables/prepend-workspace-var/output.txt b/acceptance/bundle/variables/prepend-workspace-var/output.txt index ed6c2b2af..93b652894 100644 --- a/acceptance/bundle/variables/prepend-workspace-var/output.txt +++ b/acceptance/bundle/variables/prepend-workspace-var/output.txt @@ -53,15 +53,10 @@ }, "workspace": { "artifact_path": "/Users/$USERNAME/path/to/root/artifacts", - "current_user": { - "id": "$USER.Id", - "short_name": "$USERNAME", - "userName": "$USERNAME" - }, "file_path": "/Users/$USERNAME/path/to/root/files", "profile": "profile_name", "resource_path": "/Users/$USERNAME/path/to/root/resources", "root_path": "/Users/$USERNAME/path/to/root", "state_path": "/Users/$USERNAME/path/to/root/state" } -} \ No newline at end of file +} diff --git a/acceptance/bundle/variables/prepend-workspace-var/script b/acceptance/bundle/variables/prepend-workspace-var/script index de6bc8a17..e30ffb9c4 100644 --- a/acceptance/bundle/variables/prepend-workspace-var/script +++ b/acceptance/bundle/variables/prepend-workspace-var/script @@ -1,2 +1,2 @@ echo /Workspace should be prepended on all paths, but it is not the case: #2181 -$CLI bundle validate -o json +$CLI bundle validate -o json | jq 'del(.workspace.current_user)' diff --git a/acceptance/bundle/variables/resolve-builtin/output.txt b/acceptance/bundle/variables/resolve-builtin/output.txt index 0c1678f84..f37a2a19e 100644 --- a/acceptance/bundle/variables/resolve-builtin/output.txt +++ b/acceptance/bundle/variables/resolve-builtin/output.txt @@ -1,10 +1,5 @@ { "artifact_path": "TestResolveVariableReferences/bar/artifacts", - "current_user": { - "id": "$USER.Id", - "short_name": "$USERNAME", - "userName": "$USERNAME" - }, "file_path": "TestResolveVariableReferences/bar/baz", "resource_path": "TestResolveVariableReferences/bar/resources", "root_path": "TestResolveVariableReferences/bar", diff --git a/acceptance/bundle/variables/resolve-builtin/script b/acceptance/bundle/variables/resolve-builtin/script index fefd9abe6..558d0a7ca 100644 --- a/acceptance/bundle/variables/resolve-builtin/script +++ b/acceptance/bundle/variables/resolve-builtin/script @@ -1 +1 @@ -$CLI bundle validate -o json | jq .workspace +$CLI bundle validate -o json | jq .workspace | jq 'del(.current_user)' diff --git a/acceptance/bundle/variables/resolve-builtin/test.toml b/acceptance/bundle/variables/resolve-builtin/test.toml new file mode 100644 index 000000000..085fab6c0 --- /dev/null +++ b/acceptance/bundle/variables/resolve-builtin/test.toml @@ -0,0 +1,2 @@ +# Cloud run fails with Error: Path (TestResolveVariableReferences/bar/baz) doesn't start with '/' +LocalOnly = true diff --git a/acceptance/bundle/variables/resolve-vars-in-root-path/output.txt b/acceptance/bundle/variables/resolve-vars-in-root-path/output.txt index 51eb40c91..fb828d826 100644 --- a/acceptance/bundle/variables/resolve-vars-in-root-path/output.txt +++ b/acceptance/bundle/variables/resolve-vars-in-root-path/output.txt @@ -1,10 +1,5 @@ { "artifact_path": "TestResolveVariableReferencesToBundleVariables/bar/artifacts", - "current_user": { - "id": "$USER.Id", - "short_name": "$USERNAME", - "userName": "$USERNAME" - }, "file_path": "TestResolveVariableReferencesToBundleVariables/bar/files", "resource_path": "TestResolveVariableReferencesToBundleVariables/bar/resources", "root_path": "TestResolveVariableReferencesToBundleVariables/bar", diff --git a/acceptance/bundle/variables/resolve-vars-in-root-path/script b/acceptance/bundle/variables/resolve-vars-in-root-path/script index fefd9abe6..558d0a7ca 100644 --- a/acceptance/bundle/variables/resolve-vars-in-root-path/script +++ b/acceptance/bundle/variables/resolve-vars-in-root-path/script @@ -1 +1 @@ -$CLI bundle validate -o json | jq .workspace +$CLI bundle validate -o json | jq .workspace | jq 'del(.current_user)' diff --git a/acceptance/bundle/variables/resolve-vars-in-root-path/test.toml b/acceptance/bundle/variables/resolve-vars-in-root-path/test.toml new file mode 100644 index 000000000..d833bd848 --- /dev/null +++ b/acceptance/bundle/variables/resolve-vars-in-root-path/test.toml @@ -0,0 +1,2 @@ +# Cloud run fails with Error: Path (TestResolveVariableReferencesToBundleVariables/bar/files) doesn't start with '/' +LocalOnly = true diff --git a/acceptance/config_test.go b/acceptance/config_test.go index beceb6a08..c7be223de 100644 --- a/acceptance/config_test.go +++ b/acceptance/config_test.go @@ -26,6 +26,9 @@ type TestConfig struct { // If absent, default to true. GOOS map[string]bool + // If true, do not run this test against cloud environment + LocalOnly bool + // List of additional replacements to apply on this test. // Old is a regexp, New is a replacement expression. Repls []testdiff.Replacement diff --git a/acceptance/terraform/output.txt b/acceptance/terraform/output.txt index c3d453ea5..32589ddab 100644 --- a/acceptance/terraform/output.txt +++ b/acceptance/terraform/output.txt @@ -37,7 +37,7 @@ commands will detect it and remind you to do so if necessary. >>> $TERRAFORM plan -no-color data.databricks_current_user.me: Reading... -data.databricks_current_user.me: Read complete after 0s [id=$USER.Id] +data.databricks_current_user.me: Read complete after (redacted) [id=$USER.Id] Changes to Outputs: + username = "$USERNAME" diff --git a/acceptance/terraform/test.toml b/acceptance/terraform/test.toml new file mode 100644 index 000000000..a6849e30f --- /dev/null +++ b/acceptance/terraform/test.toml @@ -0,0 +1,3 @@ +[[Repls]] +Old = 'Read complete after [^\s]+' +New = 'Read complete after (redacted)' diff --git a/acceptance/workspace/jobs/create/test.toml b/acceptance/workspace/jobs/create/test.toml index 1bf36547b..e69569c18 100644 --- a/acceptance/workspace/jobs/create/test.toml +++ b/acceptance/workspace/jobs/create/test.toml @@ -1,3 +1,4 @@ +LocalOnly = true # request recording currently does not work with cloud environment RecordRequests = true [[Server]]