Skip to content

Commit

Permalink
Merge pull request #10911 from tharun208/fix/minikube_status_for_sche…
Browse files Browse the repository at this point in the history
…duled_stop

Fix/minikube status for scheduled stop
  • Loading branch information
medyagh authored Mar 25, 2021
2 parents d0afd8b + a0487d7 commit eee2254
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit eee2254

Please sign in to comment.