diff --git a/pkg/oci/containerize_test.go b/pkg/oci/containerize_test.go index 33acffb461..a330b08ea8 100644 --- a/pkg/oci/containerize_test.go +++ b/pkg/oci/containerize_test.go @@ -1,6 +1,8 @@ package oci import ( + "errors" + "os" "path/filepath" "runtime" "testing" @@ -10,7 +12,16 @@ import ( // links which are absolute or refer to targets outside the given root, in // addition to the basic job of returning the value of reading the link. func Test_validatedLinkTarget(t *testing.T) { - root := "testdata/test-links" + root := filepath.Join("testdata", "test-links") + + err := os.Symlink("/var/example/absolute/link", filepath.Join(root, "absoluteLink")) + if err != nil && !errors.Is(err, os.ErrExist) { + t.Fatal(err) + } + err = os.Symlink("c://some/absolute/path", filepath.Join(root, "absoluteLinkWindows")) + if err != nil && !errors.Is(err, os.ErrExist) { + t.Fatal(err) + } // Windows-specific absolute link and link target values: absoluteLink := "absoluteLink" diff --git a/pkg/oci/testdata/test-links/absoluteLink b/pkg/oci/testdata/test-links/absoluteLink deleted file mode 120000 index 28434a9033..0000000000 --- a/pkg/oci/testdata/test-links/absoluteLink +++ /dev/null @@ -1 +0,0 @@ -/var/example/absolute/link \ No newline at end of file diff --git a/pkg/oci/testdata/test-links/absoluteLinkWindows b/pkg/oci/testdata/test-links/absoluteLinkWindows deleted file mode 120000 index c3aaf3f5c3..0000000000 --- a/pkg/oci/testdata/test-links/absoluteLinkWindows +++ /dev/null @@ -1 +0,0 @@ -c://some/absolute/path \ No newline at end of file