Merge pull request #6541 from anencore94/deleteContext
Fix to delete context when delete minikubepull/6555/head
commit
8762c48921
|
@ -238,7 +238,7 @@ func deleteProfile(profile *pkg_config.Profile) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteContext(machineName string) error {
|
func deleteContext(machineName string) error {
|
||||||
if err := kubeconfig.DeleteContext(constants.KubeconfigPath, machineName); err != nil {
|
if err := kubeconfig.DeleteContext(machineName); err != nil {
|
||||||
return DeletionError{Err: fmt.Errorf("update config: %v", err), Errtype: Fatal}
|
return DeletionError{Err: fmt.Errorf("update config: %v", err), Errtype: Fatal}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,14 @@ func TestStartStop(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%s failed: %v", rr.Args, err)
|
t.Errorf("%s failed: %v", rr.Args, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s failed: %v", rr.Args, err)
|
||||||
|
}
|
||||||
|
if notDeleted := strings.Contains(rr.Output(), profile); notDeleted {
|
||||||
|
t.Errorf(" kubeconfig of %s is not deleted = %t; want = %t", profile, notDeleted, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue