diff --git a/pkg/minikube/schedule/daemonize_unix.go b/pkg/minikube/schedule/daemonize_unix.go index 022b6de8a6d9..96777a178b54 100644 --- a/pkg/minikube/schedule/daemonize_unix.go +++ b/pkg/minikube/schedule/daemonize_unix.go @@ -28,7 +28,9 @@ import ( "github.com/VividCortex/godaemon" "github.com/pkg/errors" "k8s.io/klog/v2" + "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/localpath" + "k8s.io/minikube/pkg/minikube/mustload" ) // KillExisting kills existing scheduled stops by looking up the PID @@ -38,6 +40,11 @@ func KillExisting(profiles []string) { if err := killPIDForProfile(profile); err != nil { klog.Errorf("error killng PID for profile %s: %v", profile, err) } + _, cc := mustload.Partial(profile) + cc.ScheduledStop = nil + if err := config.SaveProfile(profile, cc); err != nil { + klog.Errorf("error saving profile for profile %s: %v", profile, err) + } } } diff --git a/test/integration/scheduled_stop_test.go b/test/integration/scheduled_stop_test.go index ac84d7f96bef..7719a8c216b6 100644 --- a/test/integration/scheduled_stop_test.go +++ b/test/integration/scheduled_stop_test.go @@ -105,7 +105,10 @@ func TestScheduledStopUnix(t *testing.T) { // sleep 12 just to be safe stopMinikube(ctx, t, profile, []string{"--cancel-scheduled"}) time.Sleep(12 * time.Second) + // make sure minikube status is "Running" ensureMinikubeStatus(ctx, t, profile, "Host", state.Running.String()) + // make sure minikube timetoStop is not present + ensureTimeToStopNotPresent(ctx, t, profile) // schedule another stop, make sure minikube status is "Stopped" stopMinikube(ctx, t, profile, []string{"--schedule", "5s"})