mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-13 13:46:46 +00:00
unit-test: delete what ioutil.TempFile creates
ioutil.TempFile creates a new temporary file in the directory dir. It is the caller's responsibility to remove the file when no longer needed. Fixes: #2398 Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
parent
0244d95edd
commit
7186c01d6e
@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@ -128,6 +129,7 @@ func TestAcrnArchBaseAppendImage(t *testing.T) {
|
||||
|
||||
image, err := ioutil.TempFile("", "img")
|
||||
assert.NoError(err)
|
||||
defer os.Remove(image.Name())
|
||||
err = image.Close()
|
||||
assert.NoError(err)
|
||||
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@ -287,6 +288,7 @@ func TestQemuArchBaseAppendImage(t *testing.T) {
|
||||
|
||||
image, err := ioutil.TempFile("", "img")
|
||||
assert.NoError(err)
|
||||
defer os.Remove(image.Name())
|
||||
err = image.Close()
|
||||
assert.NoError(err)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user