mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-04 00:24:59 +00:00
use temp file for kubeconfig in test
Kubernetes-commit: 03af5089afb5d31707e7d91e55dfd6b157e6f8e1
This commit is contained in:
committed by
Kubernetes Publisher
parent
744b11616f
commit
69308bcf06
@@ -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",
|
||||
|
Reference in New Issue
Block a user