Skip to content

Commit 4a09c4d

Browse files
authored
fix: Broken tests for mac (#431)
These tests are broken for mac because `/var/folder` is a sym link to `/private/var/folder`. Signed-off-by: Terry Howe <tlhowe@amazon.com>
1 parent 96a37c2 commit 4a09c4d

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

content/file/file_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ func TestStore_Success(t *testing.T) {
212212
}
213213

214214
func TestStore_RelativeRoot_Success(t *testing.T) {
215-
tempDir := t.TempDir()
215+
tempDir, err := filepath.EvalSymlinks(t.TempDir())
216+
if err != nil {
217+
t.Fatal("error calling filepath.EvalSymlinks(), error =", err)
218+
}
216219
currDir, err := os.Getwd()
217220
if err != nil {
218221
t.Fatal("error calling Getwd(), error=", err)

content/file/file_unix_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ func TestStore_Dir_ExtractSymlinkRel(t *testing.T) {
132132
// Related issue: https://github.com/oras-project/oras-go/issues/402
133133
func TestStore_Dir_ExtractSymlinkAbs(t *testing.T) {
134134
// prepare test content
135-
tempDir := t.TempDir()
135+
tempDir, err := filepath.EvalSymlinks(t.TempDir())
136+
if err != nil {
137+
t.Fatal("error calling filepath.EvalSymlinks(), error =", err)
138+
}
136139
dirName := "testdir"
137140
dirPath := filepath.Join(tempDir, dirName)
138141
if err := os.MkdirAll(dirPath, 0777); err != nil {

content/oci/oci_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ func TestStore_RelativeRoot_Success(t *testing.T) {
194194
manifestDesc := content.NewDescriptorFromBytes(ocispec.MediaTypeImageManifest, manifest)
195195
ref := "foobar"
196196

197-
tempDir := t.TempDir()
197+
tempDir, err := filepath.EvalSymlinks(t.TempDir())
198+
if err != nil {
199+
t.Fatal("error calling filepath.EvalSymlinks(), error =", err)
200+
}
198201
currDir, err := os.Getwd()
199202
if err != nil {
200203
t.Fatal("error calling Getwd(), error=", err)

content/oci/storage_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ func TestStorage_RelativeRoot_Success(t *testing.T) {
8787
Size: int64(len(content)),
8888
}
8989

90-
tempDir := t.TempDir()
90+
tempDir, err := filepath.EvalSymlinks(t.TempDir())
91+
if err != nil {
92+
t.Fatal("error calling filepath.EvalSymlinks(), error =", err)
93+
}
9194
currDir, err := os.Getwd()
9295
if err != nil {
9396
t.Fatal("error calling Getwd(), error=", err)

0 commit comments

Comments
 (0)