Skip to content

Commit

Permalink
oci: Fix broken action
Browse files Browse the repository at this point in the history
The broken symlinks used for tests broke the use of
fluxcd/pkg as a GitHub action, as pointed out in:
fluxcd/flux2#2964

This creates and removes such symlinks on demand
to ensure the tests are still catered for, without
impacting the GitHub actions.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
  • Loading branch information
Paulo Gomes committed Aug 8, 2022
1 parent 785f99a commit 1bde346
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
33 changes: 33 additions & 0 deletions oci/client/internal/fs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,39 @@ var (
mu sync.Mutex
)

func TestMain(m *testing.M) {
symlinks := []struct {
oldPath string
newPath string
}{
{
oldPath: "C:/Users/fluxcd/go/src/github.com/golang/dep/internal/fs/testdata/test.file",
newPath: "testdata/symlinks/windows-file-symlink",
},
{
"/non/existing/file",
"testdata/symlinks/invalid-symlink",
},
}
for _, sl := range symlinks {
err := os.Symlink(sl.oldPath, sl.newPath)
if err != nil {
panic(err)
}
}

c := m.Run()

for _, sl := range symlinks {
err := os.Remove(sl.newPath)
if err != nil {
panic(err)
}
}

os.Exit(c)
}

func TestRenameWithFallback(t *testing.T) {
dir := t.TempDir()

Expand Down
1 change: 0 additions & 1 deletion oci/client/internal/fs/testdata/symlinks/invalid-symlink

This file was deleted.

This file was deleted.

0 comments on commit 1bde346

Please sign in to comment.