Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-v1.17] Create test symlinks dynamically #1065

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkg/oci/containerize_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package oci

import (
"errors"
"os"
"path/filepath"
"runtime"
"testing"
Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion pkg/oci/testdata/test-links/absoluteLink

This file was deleted.

1 change: 0 additions & 1 deletion pkg/oci/testdata/test-links/absoluteLinkWindows

This file was deleted.

Loading