mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
4be2652085
commit
0d77b60de7
@@ -1,8 +1,6 @@
|
||||
package storage_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
@@ -14,10 +12,7 @@ import (
|
||||
|
||||
func TestCache(t *testing.T) {
|
||||
Convey("Make a new cache", t, func() {
|
||||
dir, err := ioutil.TempDir("", "cache_test")
|
||||
So(err, ShouldBeNil)
|
||||
So(dir, ShouldNotBeEmpty)
|
||||
defer os.RemoveAll(dir)
|
||||
dir := t.TempDir()
|
||||
|
||||
log := log.NewLogger("debug", "")
|
||||
So(log, ShouldNotBeNil)
|
||||
|
||||
Reference in New Issue
Block a user