mirror of https://github.com/knative/func.git
Create test symlinks dynamically (#2681)
Some tools dislike having questionable symlinks in git repository so we must create this symlinks dynamically in the test instead of having it committed into the repository. Signed-off-by: Matej Vašek <matejvasek@gmail.com>
This commit is contained in:
parent
4b1cc39731
commit
d20eb9685f
|
@ -1,6 +1,8 @@
|
||||||
package oci
|
package oci
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -10,7 +12,16 @@ import (
|
||||||
// links which are absolute or refer to targets outside the given root, in
|
// 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.
|
// addition to the basic job of returning the value of reading the link.
|
||||||
func Test_validatedLinkTarget(t *testing.T) {
|
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:
|
// Windows-specific absolute link and link target values:
|
||||||
absoluteLink := "absoluteLink"
|
absoluteLink := "absoluteLink"
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/var/example/absolute/link
|
|
|
@ -1 +0,0 @@
|
||||||
c://some/absolute/path
|
|
Loading…
Reference in New Issue