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:
Penny Zheng 2020-01-17 15:29:50 +08:00
parent 0244d95edd
commit 7186c01d6e
2 changed files with 4 additions and 0 deletions

View File

@ -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)

View File

@ -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)