Fix hardcoded tmp dir path in kubectl test.

This commit is contained in:
Dong Liu 2017-05-11 15:57:23 +08:00
parent 3f6be95f82
commit 42f600870e

View File

@ -281,8 +281,11 @@ func TestRefetchSchemaWhenValidationFails(t *testing.T) {
}
}),
}
dir := os.TempDir() + "/schemaCache"
os.RemoveAll(dir)
dir, err := ioutil.TempDir("", "schemaCache")
if err != nil {
t.Fatalf("Error getting tempDir: %v", err)
}
defer os.RemoveAll(dir)
fullDir, err := substituteUserHome(dir)
if err != nil {
@ -339,8 +342,11 @@ func TestValidateCachesSchema(t *testing.T) {
}
}),
}
dir := os.TempDir() + "/schemaCache"
os.RemoveAll(dir)
dir, err := ioutil.TempDir("", "schemaCache")
if err != nil {
t.Fatalf("Error getting tempDir: %v", err)
}
defer os.RemoveAll(dir)
obj := &api.Pod{}
data, err := runtime.Encode(testapi.Default.Codec(), obj)