Commit b4b5bfdb authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45648 from karataliu/fixtmpdir

Automatic merge from submit-queue Fix hardcoded tmp dir path in kubectl test. **What this PR does / why we need it**: Current case uses hardcoded tmp dir path, and it does not delete tmp dir after test run. Which means 1. The case could not be run by different users (no permission) 2. /tmp dir keeps growing. **Which issue this PR fixes** **Special notes for your reviewer**: **Release note**:
parents 5c23dc78 42f60087
......@@ -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)
......
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