Merge pull request #73816 from mkumatag/fix_tmpdir

Use ioutil.TempDir for temporary dir creation
pull/564/head
Kubernetes Prow Robot 2019-02-07 13:33:19 -08:00 committed by GitHub
commit 920045652d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
@ -415,8 +416,12 @@ func TestProcessHostnameOverrideFlag(t *testing.T) {
func TestConfigChange(t *testing.T) {
setUp := func() (*os.File, string, error) {
tempDir := os.TempDir()
file, err := ioutil.TempFile(tempDir, "kube-proxy-config-")
tempDir, err := ioutil.TempDir("", "kubeproxy-config-change")
if err != nil {
return nil, "", fmt.Errorf("Unable to create temporary directory: %v", err)
}
fullPath := filepath.Join(tempDir, "kube-proxy-config")
file, err := os.Create(fullPath)
if err != nil {
return nil, "", fmt.Errorf("unexpected error when creating temp file: %v", err)
}