From d8073bc36fdeba113aa4c3bd2a9301f20af90d8d Mon Sep 17 00:00:00 2001 From: chanyoung Date: Thu, 22 Aug 2024 20:25:57 +0900 Subject: [PATCH] tests: fix unit test failure on macOS due to temp directory path Use os.TempDir() instead of '/tmp'. This is for the peermap tests. Signed-off-by: chanyoung (cherry picked from commit d77f6e5e3d296c7ef7b5c0b2a07a5ac022870432) --- pkg/operator/ceph/csi/peermap/config_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/operator/ceph/csi/peermap/config_test.go b/pkg/operator/ceph/csi/peermap/config_test.go index 8dcf8468b..380f5434f 100644 --- a/pkg/operator/ceph/csi/peermap/config_test.go +++ b/pkg/operator/ceph/csi/peermap/config_test.go @@ -239,7 +239,7 @@ var fakeMultiPeerCephBlockPool = cephv1.CephBlockPool{ } func saveMockDataInTempFile(data, filePattern string) error { - matches, _ := filepath.Glob(fmt.Sprintf("/tmp/%s*", filePattern)) + matches, _ := filepath.Glob(fmt.Sprintf("%s/%s*", os.TempDir(), filePattern)) for _, m := range matches { file, err := os.OpenFile(m, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil {