From de5155ed0a4635d2233b8e74544e1401a01eb786 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 21 Jan 2025 12:50:28 +0100 Subject: [PATCH] Add acceptance for test for sync.paths equal to two dots (#2196) Based on integration test from @andrewnester in #2194 Manually checked that this databricks.yml passes validation on v0.235.0 but fails on v0.236.0, very like it was broken in https://github.com/databricks/cli/pull/1945 This also adds replacements for tmpdir, it's parent and (just in case) grand parent. --- acceptance/acceptance_test.go | 7 +++++++ acceptance/bundle/sync-paths-dotdot/databricks.yml | 5 +++++ acceptance/bundle/sync-paths-dotdot/output.txt | 11 +++++++++++ acceptance/bundle/sync-paths-dotdot/script | 1 + 4 files changed, 24 insertions(+) create mode 100644 acceptance/bundle/sync-paths-dotdot/databricks.yml create mode 100644 acceptance/bundle/sync-paths-dotdot/output.txt create mode 100644 acceptance/bundle/sync-paths-dotdot/script diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 5f1181313c..850d3bf9d6 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -137,6 +137,13 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont tmpDir = t.TempDir() } + repls.Set("/private"+tmpDir, "$TMPDIR") + repls.Set("/private"+filepath.Dir(tmpDir), "$TMPPARENT") + repls.Set("/private"+filepath.Dir(filepath.Dir(tmpDir)), "$TMPGPARENT") + repls.Set(tmpDir, "$TMPDIR") + repls.Set(filepath.Dir(tmpDir), "$TMPPARENT") + repls.Set(filepath.Dir(filepath.Dir(tmpDir)), "$TMPGPARENT") + scriptContents := readMergedScriptContents(t, dir) testutil.WriteFile(t, filepath.Join(tmpDir, EntryPointScript), scriptContents) diff --git a/acceptance/bundle/sync-paths-dotdot/databricks.yml b/acceptance/bundle/sync-paths-dotdot/databricks.yml new file mode 100644 index 0000000000..7215ffea29 --- /dev/null +++ b/acceptance/bundle/sync-paths-dotdot/databricks.yml @@ -0,0 +1,5 @@ +bundle: + name: test-bundle +sync: + paths: + - .. diff --git a/acceptance/bundle/sync-paths-dotdot/output.txt b/acceptance/bundle/sync-paths-dotdot/output.txt new file mode 100644 index 0000000000..11db3e9ee0 --- /dev/null +++ b/acceptance/bundle/sync-paths-dotdot/output.txt @@ -0,0 +1,11 @@ +Error: path "$TMPPARENT" is not within repository root "$TMPDIR" + +Name: test-bundle +Target: default +Workspace: + User: $USERNAME + Path: /Workspace/Users/$USERNAME/.bundle/test-bundle/default + +Found 1 error + +Exit code: 1 diff --git a/acceptance/bundle/sync-paths-dotdot/script b/acceptance/bundle/sync-paths-dotdot/script new file mode 100644 index 0000000000..72555b332a --- /dev/null +++ b/acceptance/bundle/sync-paths-dotdot/script @@ -0,0 +1 @@ +$CLI bundle validate