Merge pull request #6541 from anencore94/deleteContext

Fix to delete context when delete minikube
pull/6555/head
Thomas Strömberg 2020-02-07 16:15:56 -08:00 committed by GitHub
commit 8762c48921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -238,7 +238,7 @@ func deleteProfile(profile *pkg_config.Profile) 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}
}

View File

@ -153,6 +153,14 @@ func TestStartStop(t *testing.T) {
if err != nil {
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)
}
}
})
}