use TempDir instead of /tmp/zot in tests

Closes #508

Signed-off-by: Shivam Mishra <shimish2@cisco.com>
This commit is contained in:
Shivam Mishra 2022-05-03 19:43:33 +00:00 committed by Ramkumar Chinchani
parent 97173a54dd
commit e04a9bf6e2

View File

@ -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)