Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/minikube status for scheduled stop #10911

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/minikube/schedule/daemonize_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/integration/scheduled_stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down