mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
use temp file for kubeconfig in test
This commit is contained in:
parent
d745508cc0
commit
03af5089af
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user