Merge pull request #67347 from juanvallejo/jvallejo/use-temp-file-config-tests

Automatic merge from submit-queue (batch tested with PRs 67347, 67307, 67358, 67364, 67385). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use temp file for kubeconfig in test

Followup to https://github.com/kubernetes/kubernetes/pull/67093

Updates client_config_test to use a temporary file for kubeconfig.

**Release note**:
```release-note
NONE
```

cc @deads2k @soltysh
This commit is contained in:
Kubernetes Submit Queue 2018-08-15 04:23:08 -07:00 committed by GitHub
commit 46bfa1ab17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,9 +132,17 @@ func TestModifyContext(t *testing.T) {
"clean": true, "clean": true,
} }
tempPath, err := ioutil.TempFile("", "testclientcmd-")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
defer os.Remove(tempPath.Name())
pathOptions := NewDefaultPathOptions() pathOptions := NewDefaultPathOptions()
config := createValidTestConfig() config := createValidTestConfig()
pathOptions.GlobalFile = tempPath.Name()
// define new context and assign it - our path options config // define new context and assign it - our path options config
config.Contexts["updated"] = &clientcmdapi.Context{ config.Contexts["updated"] = &clientcmdapi.Context{
Cluster: "updated", Cluster: "updated",