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 <park910113@gmail.com>
(cherry picked from commit d77f6e5e3d)
This commit is contained in:
chanyoung authored and Mergify committed 2024-08-23 13:16:17 +00:00
1 parent 279eaa3d18
commit d8073bc36f
1 file changed
+1 -1
+1 -1
View File
@@ -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 {