libct/*_test.go: use t.TempDir

Replace ioutil.TempDir (mostly) with t.TempDir, which require no
explicit cleanup.

While at it, fix incorrect usage of os.ModePerm in libcontainer/intelrdt
test. This is supposed to be a mask, not mode bits.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-07-19 17:25:41 -07:00
parent 3bc606e9d3
commit a91ce3062f
9 changed files with 21 additions and 115 deletions
+1 -8
View File
@@ -4,7 +4,6 @@ package libcontainer
import (
"fmt"
"io/ioutil"
"os"
"testing"
@@ -339,14 +338,8 @@ func TestGetContainerStateAfterUpdate(t *testing.T) {
t.Fatal(err)
}
rootDir, err := ioutil.TempDir("", "TestGetContainerStateAfterUpdate")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(rootDir)
container := &linuxContainer{
root: rootDir,
root: t.TempDir(),
id: "myid",
config: &configs.Config{
Namespaces: []configs.Namespace{