Skip to content

Commit 460f8d0

Browse files
author
anencore94
committed
Fix bug to delete context when delete minikube
- when `minikube delete`, minikube must delete its config which are set when `minikube start`. - But, there was some mistakes in the function that does this logic Signed-off-by: anencore94 <[email protected]>
1 parent 9b7573e commit 460f8d0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cmd/minikube/cmd/delete.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func deleteProfile(profile *pkg_config.Profile) error {
238238
}
239239

240240
func deleteContext(machineName string) error {
241-
if err := kubeconfig.DeleteContext(constants.KubeconfigPath, machineName); err != nil {
241+
if err := kubeconfig.DeleteContext(machineName, constants.KubeconfigPath); err != nil {
242242
return DeletionError{Err: fmt.Errorf("update config: %v", err), Errtype: Fatal}
243243
}
244244

test/integration/start_stop_delete_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ func TestStartStop(t *testing.T) {
153153
if err != nil {
154154
t.Errorf("%s failed: %v", rr.Args, err)
155155
}
156+
157+
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts"))
158+
if err != nil {
159+
t.Fatalf("%s failed: %v", rr.Args, err)
160+
}
161+
if notDeleted := strings.Contains(rr.Output(), profile); notDeleted {
162+
t.Errorf(" kubeconfig of %s is not deleted = %t; want = %t", profile, notDeleted, false)
163+
}
156164
}
157165
})
158166
}

0 commit comments

Comments
 (0)