mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 12:28:01 +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
+2
-6
@@ -43,12 +43,8 @@ type AuditLog struct {
|
||||
|
||||
func TestAuditLogMessages(t *testing.T) {
|
||||
Convey("Make a new controller", t, func() {
|
||||
dir, err := ioutil.TempDir("", "oci-repo-test")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer os.RemoveAll(dir)
|
||||
err = CopyFiles("../../test/data", dir)
|
||||
dir := t.TempDir()
|
||||
err := CopyFiles("../../test/data", dir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user