mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
if test succ remove the tmp file
This commit is contained in:
parent
9e1960c507
commit
010bca6323
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"syscall"
|
||||
@ -308,6 +309,11 @@ func TestDumpReaderToFile(t *testing.T) {
|
||||
}
|
||||
defer syscall.Unlink(tempFile.Name())
|
||||
defer tempFile.Close()
|
||||
defer func() {
|
||||
if !t.Failed() {
|
||||
os.Remove(tempFile.Name())
|
||||
}
|
||||
}()
|
||||
err = DumpReaderToFile(strings.NewReader(testString), tempFile.Name())
|
||||
if err != nil {
|
||||
t.Errorf("error in DumpReaderToFile: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user