This commit is contained in:
Shreyas Goenka 2025-02-03 12:14:23 +01:00
commit 4f979007af
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
19 changed files with 38 additions and 42 deletions

View File

@ -51,12 +51,12 @@ schema:
docs: docs:
go run ./bundle/docsgen ./bundle/internal/schema ./bundle/docsgen 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)
integration-short: integration-short: vendor
$(INTEGRATION) -short $(INTEGRATION) -short
.PHONY: lint lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short acc-cover acc-showcover docs .PHONY: lint lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short acc-cover acc-showcover docs

View File

@ -211,6 +211,11 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
t.Skipf("Disabled via GOOS.%s setting in %s", runtime.GOOS, configPath) 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 tmpDir string
var err error var err error
if KeepTmp { if KeepTmp {
@ -352,7 +357,7 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN
bufRef, okRef := tryReading(t, pathRef) bufRef, okRef := tryReading(t, pathRef)
bufNew, okNew := tryReading(t, pathNew) bufNew, okNew := tryReading(t, pathNew)
if !okRef && !okNew { if !okRef && !okNew {
t.Errorf("Both files are missing or have errors: %s, %s", pathRef, pathNew) t.Errorf("Both files are missing or have errors: %s\npathRef: %s\npathNew: %s", relPath, pathRef, pathNew)
return return
} }
@ -367,7 +372,7 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN
// The test did not produce an expected output file. // The test did not produce an expected output file.
if okRef && !okNew { if okRef && !okNew {
t.Errorf("Missing output file: %s", relPath) t.Errorf("Missing output file: %s\npathRef: %s\npathNew: %s", relPath, pathRef, pathNew)
testdiff.AssertEqualTexts(t, pathRef, pathNew, valueRef, valueNew) testdiff.AssertEqualTexts(t, pathRef, pathNew, valueRef, valueNew)
if testdiff.OverwriteMode { if testdiff.OverwriteMode {
t.Logf("Removing output file: %s", relPath) t.Logf("Removing output file: %s", relPath)
@ -378,7 +383,7 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN
// The test produced an unexpected output file. // The test produced an unexpected output file.
if !okRef && okNew { if !okRef && okNew {
t.Errorf("Unexpected output file: %s", relPath) t.Errorf("Unexpected output file: %s\npathRef: %s\npathNew: %s", relPath, pathRef, pathNew)
testdiff.AssertEqualTexts(t, pathRef, pathNew, valueRef, valueNew) testdiff.AssertEqualTexts(t, pathRef, pathNew, valueRef, valueNew)
if testdiff.OverwriteMode { if testdiff.OverwriteMode {
t.Logf("Writing output file: %s", relPath) t.Logf("Writing output file: %s", relPath)
@ -465,7 +470,6 @@ func BuildCLI(t *testing.T, buildDir, coverDir string) string {
} }
RunCommand(t, args, "..") RunCommand(t, args, "..")
RunCommand(t, []string{execPath, "--version"}, ".")
return execPath return execPath
} }

View File

@ -0,0 +1 @@
LocalOnly = true # Deployment currently fails when run locally; once that is fixed, remove this setting

View File

@ -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

View File

@ -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

View File

@ -6,7 +6,7 @@
"git": { "git": {
"actual_branch": "main", "actual_branch": "main",
"branch": "", "branch": "",
"bundle_root_path": ".", "bundle_root_path": "."
}, },
"name": "git", "name": "git",
"target": "prod", "target": "prod",
@ -28,11 +28,6 @@
}, },
"workspace": { "workspace": {
"artifact_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/artifacts", "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", "file_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/files",
"resource_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/resources", "resource_path": "/Workspace/Users/$USERNAME/.bundle/git/prod/resources",
"root_path": "/Workspace/Users/$USERNAME/.bundle/git/prod", "root_path": "/Workspace/Users/$USERNAME/.bundle/git/prod",
@ -56,7 +51,7 @@ Validation OK!
"git": { "git": {
"actual_branch": "main", "actual_branch": "main",
"branch": "dev-branch", "branch": "dev-branch",
"bundle_root_path": ".", "bundle_root_path": "."
}, },
"name": "git", "name": "git",
"target": "dev", "target": "dev",
@ -78,11 +73,6 @@ Validation OK!
}, },
"workspace": { "workspace": {
"artifact_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/artifacts", "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", "file_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/files",
"resource_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/resources", "resource_path": "/Workspace/Users/$USERNAME/.bundle/git/dev/resources",
"root_path": "/Workspace/Users/$USERNAME/.bundle/git/dev", "root_path": "/Workspace/Users/$USERNAME/.bundle/git/dev",

View File

@ -1,6 +1,6 @@
git-repo-init 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
trace $CLI bundle validate -o json -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 | grep -v '"commit"' trace $CLI bundle validate -t dev
rm -fr .git rm -fr .git

View File

@ -53,11 +53,6 @@
}, },
"workspace": { "workspace": {
"artifact_path": "/Users/$USERNAME/path/to/root/artifacts", "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", "file_path": "/Users/$USERNAME/path/to/root/files",
"profile": "profile_name", "profile": "profile_name",
"resource_path": "/Users/$USERNAME/path/to/root/resources", "resource_path": "/Users/$USERNAME/path/to/root/resources",

View File

@ -1,2 +1,2 @@
echo /Workspace should be prepended on all paths, but it is not the case: #2181 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)'

View File

@ -1,10 +1,5 @@
{ {
"artifact_path": "TestResolveVariableReferences/bar/artifacts", "artifact_path": "TestResolveVariableReferences/bar/artifacts",
"current_user": {
"id": "$USER.Id",
"short_name": "$USERNAME",
"userName": "$USERNAME"
},
"file_path": "TestResolveVariableReferences/bar/baz", "file_path": "TestResolveVariableReferences/bar/baz",
"resource_path": "TestResolveVariableReferences/bar/resources", "resource_path": "TestResolveVariableReferences/bar/resources",
"root_path": "TestResolveVariableReferences/bar", "root_path": "TestResolveVariableReferences/bar",

View File

@ -1 +1 @@
$CLI bundle validate -o json | jq .workspace $CLI bundle validate -o json | jq .workspace | jq 'del(.current_user)'

View File

@ -0,0 +1,2 @@
# Cloud run fails with Error: Path (TestResolveVariableReferences/bar/baz) doesn't start with '/'
LocalOnly = true

View File

@ -1,10 +1,5 @@
{ {
"artifact_path": "TestResolveVariableReferencesToBundleVariables/bar/artifacts", "artifact_path": "TestResolveVariableReferencesToBundleVariables/bar/artifacts",
"current_user": {
"id": "$USER.Id",
"short_name": "$USERNAME",
"userName": "$USERNAME"
},
"file_path": "TestResolveVariableReferencesToBundleVariables/bar/files", "file_path": "TestResolveVariableReferencesToBundleVariables/bar/files",
"resource_path": "TestResolveVariableReferencesToBundleVariables/bar/resources", "resource_path": "TestResolveVariableReferencesToBundleVariables/bar/resources",
"root_path": "TestResolveVariableReferencesToBundleVariables/bar", "root_path": "TestResolveVariableReferencesToBundleVariables/bar",

View File

@ -1 +1 @@
$CLI bundle validate -o json | jq .workspace $CLI bundle validate -o json | jq .workspace | jq 'del(.current_user)'

View File

@ -0,0 +1,2 @@
# Cloud run fails with Error: Path (TestResolveVariableReferencesToBundleVariables/bar/files) doesn't start with '/'
LocalOnly = true

View File

@ -26,6 +26,9 @@ type TestConfig struct {
// If absent, default to true. // If absent, default to true.
GOOS map[string]bool 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. // List of additional replacements to apply on this test.
// Old is a regexp, New is a replacement expression. // Old is a regexp, New is a replacement expression.
Repls []testdiff.Replacement Repls []testdiff.Replacement

View File

@ -37,7 +37,7 @@ commands will detect it and remind you to do so if necessary.
>>> $TERRAFORM plan -no-color >>> $TERRAFORM plan -no-color
data.databricks_current_user.me: Reading... 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: Changes to Outputs:
+ username = "$USERNAME" + username = "$USERNAME"

View File

@ -1,3 +1,7 @@
[[Repls]] [[Repls]]
Old = 'linux_amd64' Old = 'linux_amd64'
New = 'OS_ARCH' New = 'OS_ARCH'
[[Repls]]
Old = 'Read complete after [^\s]+'
New = 'Read complete after (redacted)'

View File

@ -1,3 +1,4 @@
LocalOnly = true # request recording currently does not work with cloud environment
RecordRequests = true RecordRequests = true
[[Server]] [[Server]]