Commit 78240925 authored by Manjunath A Kumatagi's avatar Manjunath A Kumatagi

Use ioutil.TempDir for temporary dir creating

parent a0aa2222
......@@ -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)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment