From a78e3a25b2d872e51b5d6cdf418d9d2e59b4e052 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 13 Jan 2025 15:41:57 +0100 Subject: [PATCH] Update TestRelativePathsWithIncludes for absolute artifact paths --- .../relative_path_with_includes/artifact_a/.gitkeep | 0 .../subfolder/artifact_b/.gitkeep | 0 bundle/tests/relative_path_with_includes_test.go | 9 +++++++-- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 bundle/tests/relative_path_with_includes/artifact_a/.gitkeep create mode 100644 bundle/tests/relative_path_with_includes/subfolder/artifact_b/.gitkeep diff --git a/bundle/tests/relative_path_with_includes/artifact_a/.gitkeep b/bundle/tests/relative_path_with_includes/artifact_a/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/bundle/tests/relative_path_with_includes/subfolder/artifact_b/.gitkeep b/bundle/tests/relative_path_with_includes/subfolder/artifact_b/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/bundle/tests/relative_path_with_includes_test.go b/bundle/tests/relative_path_with_includes_test.go index 6e13628be..a61cd8383 100644 --- a/bundle/tests/relative_path_with_includes_test.go +++ b/bundle/tests/relative_path_with_includes_test.go @@ -8,6 +8,7 @@ import ( "github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle/config/mutator" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestRelativePathsWithIncludes(t *testing.T) { @@ -17,8 +18,12 @@ func TestRelativePathsWithIncludes(t *testing.T) { diags := bundle.Apply(context.Background(), b, m) assert.NoError(t, diags.Error()) - assert.Equal(t, "artifact_a", b.Config.Artifacts["test_a"].Path) - assert.Equal(t, filepath.Join("subfolder", "artifact_b"), b.Config.Artifacts["test_b"].Path) + relA, err := filepath.Rel(b.SyncRootPath, b.Config.Artifacts["test_a"].Path) + require.NoError(t, err) + assert.Equal(t, "artifact_a", relA) + relB, err := filepath.Rel(b.SyncRootPath, b.Config.Artifacts["test_b"].Path) + require.NoError(t, err) + assert.Equal(t, filepath.Join("subfolder", "artifact_b"), relB) assert.ElementsMatch( t,