From e04a9bf6e2b1c74cb4bcb4eda606d1f21c9af7c2 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 3 May 2022 19:43:33 +0000 Subject: [PATCH] use TempDir instead of /tmp/zot in tests Closes #508 Signed-off-by: Shivam Mishra --- pkg/cli/extensions_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/cli/extensions_test.go b/pkg/cli/extensions_test.go index 98ed2d0f..8865acb3 100644 --- a/pkg/cli/extensions_test.go +++ b/pkg/cli/extensions_test.go @@ -578,7 +578,7 @@ func TestServeSearchExtension(t *testing.T) { content := fmt.Sprintf(`{ "storage": { - "rootDirectory": "/tmp/zot" + "rootDirectory": "%s" }, "http": { "address": "127.0.0.1", @@ -592,7 +592,7 @@ func TestServeSearchExtension(t *testing.T) { "search": { } } - }`, port, logFile.Name()) + }`, t.TempDir(), port, logFile.Name()) cfgfile, err := ioutil.TempFile("", "zot-test*.json") So(err, ShouldBeNil) @@ -625,7 +625,7 @@ func TestServeSearchExtension(t *testing.T) { content := fmt.Sprintf(`{ "storage": { - "rootDirectory": "/tmp/zot" + "rootDirectory": "%s" }, "http": { "address": "127.0.0.1", @@ -642,7 +642,7 @@ func TestServeSearchExtension(t *testing.T) { } } } - }`, port, logFile.Name()) + }`, t.TempDir(), port, logFile.Name()) cfgfile, err := ioutil.TempFile("", "zot-test*.json") So(err, ShouldBeNil) @@ -678,7 +678,7 @@ func TestServeSearchExtension(t *testing.T) { content := fmt.Sprintf(`{ "storage": { - "rootDirectory": "/tmp/zot" + "rootDirectory": "%s" }, "http": { "address": "127.0.0.1", @@ -693,7 +693,7 @@ func TestServeSearchExtension(t *testing.T) { "enable": true } } - }`, port, logFile.Name()) + }`, t.TempDir(), port, logFile.Name()) cfgfile, err := ioutil.TempFile("", "zot-test*.json") So(err, ShouldBeNil) @@ -726,7 +726,7 @@ func TestServeSearchExtension(t *testing.T) { content := fmt.Sprintf(`{ "storage": { - "rootDirectory": "/tmp/zot" + "rootDirectory": "%s" }, "http": { "address": "127.0.0.1", @@ -744,7 +744,7 @@ func TestServeSearchExtension(t *testing.T) { } } } - }`, port, logFile.Name()) + }`, t.TempDir(), port, logFile.Name()) cfgfile, err := ioutil.TempFile("", "zot-test*.json") So(err, ShouldBeNil)