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:
@@ -35,15 +35,7 @@ import (
|
||||
|
||||
// TestDaemonRuntimeRoot ensures plugin.linux.runtime_root is not ignored
|
||||
func TestDaemonRuntimeRoot(t *testing.T) {
|
||||
runtimeRoot, err := os.MkdirTemp("", "containerd-test-runtime-root")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
os.RemoveAll(runtimeRoot)
|
||||
}
|
||||
}()
|
||||
runtimeRoot := t.TempDir()
|
||||
configTOML := `
|
||||
version = 2
|
||||
[plugins]
|
||||
|
Reference in New Issue
Block a user