From 69308bcf06bc25ae04ee5233a4a8789e3a699529 Mon Sep 17 00:00:00 2001 From: juanvallejo Date: Mon, 13 Aug 2018 14:29:34 -0400 Subject: [PATCH] use temp file for kubeconfig in test Kubernetes-commit: 03af5089afb5d31707e7d91e55dfd6b157e6f8e1 --- tools/clientcmd/client_config_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/clientcmd/client_config_test.go b/tools/clientcmd/client_config_test.go index a13fe72b..a209da42 100644 --- a/tools/clientcmd/client_config_test.go +++ b/tools/clientcmd/client_config_test.go @@ -132,9 +132,17 @@ func TestModifyContext(t *testing.T) { "clean": true, } + tempPath, err := ioutil.TempFile("", "testclientcmd-") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + defer os.Remove(tempPath.Name()) + pathOptions := NewDefaultPathOptions() config := createValidTestConfig() + pathOptions.GlobalFile = tempPath.Name() + // define new context and assign it - our path options config config.Contexts["updated"] = &clientcmdapi.Context{ Cluster: "updated",