From 373cfff98e18250a1cd2167d4bec07187c2046b3 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Thu, 9 Jan 2025 17:49:17 +0800 Subject: [PATCH] fix tests Signed-off-by: Lixia (Sylvia) Lei --- content/file/utils_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/content/file/utils_test.go b/content/file/utils_test.go index 7d93f73a..ebdff891 100644 --- a/content/file/utils_test.go +++ b/content/file/utils_test.go @@ -104,7 +104,8 @@ func Test_ensureBasePath(t *testing.T) { if err := os.MkdirAll(filepath.Join(root, "hello world", "foo", "bar"), 0700); err != nil { t.Fatal("failed to create temp folders:", err) } - base := "hello world/foo" + baseRel := "hello world/foo" + baseAbs := filepath.Join(root, baseRel) tests := []struct { name string @@ -155,7 +156,7 @@ func Test_ensureBasePath(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := ensureBasePath(root, base, tt.target) + got, err := ensureBasePath(baseAbs, baseRel, tt.target) if (err != nil) != tt.wantErr { t.Errorf("ensureBasePath() error = %v, wantErr %v", err, tt.wantErr) return @@ -172,7 +173,8 @@ func Test_ensureLinkPath(t *testing.T) { if err := os.MkdirAll(filepath.Join(root, "hello world", "foo", "bar"), 0700); err != nil { t.Fatal("failed to create temp folders:", err) } - base := "hello world/foo" + baseRel := "hello world/foo" + baseAbs := filepath.Join(root, baseRel) tests := []struct { name string @@ -220,7 +222,7 @@ func Test_ensureLinkPath(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := ensureLinkPath(root, base, tt.link, tt.target) + got, err := ensureLinkPath(baseAbs, baseRel, tt.link, tt.target) if (err != nil) != tt.wantErr { t.Errorf("ensureLinkPath() error = %v, wantErr %v", err, tt.wantErr) return