Merge pull request #12923 from sharifelgamal/sched-ctd
fix scheduled stop test for containerd on docker driverpull/12940/head
commit
75e2466cf9
|
@ -691,6 +691,11 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
|
|||
cc.KicBaseImage = viper.GetString(kicBaseImage)
|
||||
}
|
||||
|
||||
// If this cluster was stopped by a scheduled stop, clear the config
|
||||
if cc.ScheduledStop != nil && time.Until(time.Unix(cc.ScheduledStop.InitiationTime, 0).Add(cc.ScheduledStop.Duration)) <= 0 {
|
||||
cc.ScheduledStop = nil
|
||||
}
|
||||
|
||||
return cc
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ import (
|
|||
func KillExisting(profiles []string) {
|
||||
for _, profile := range profiles {
|
||||
if err := killPIDForProfile(profile); err != nil {
|
||||
klog.Errorf("error killng PID for profile %s: %v", profile, err)
|
||||
klog.Warningf("error killng PID for profile %s: %v", profile, err)
|
||||
}
|
||||
_, cc := mustload.Partial(profile)
|
||||
cc.ScheduledStop = nil
|
||||
|
|
|
@ -94,29 +94,30 @@ func TestScheduledStopUnix(t *testing.T) {
|
|||
}
|
||||
|
||||
// schedule a second stop which should cancel the first scheduled stop
|
||||
stopMinikube(ctx, t, profile, []string{"--schedule", "8s"})
|
||||
stopMinikube(ctx, t, profile, []string{"--schedule", "15s"})
|
||||
if processRunning(t, pid) {
|
||||
t.Fatalf("process %v running but should have been killed on reschedule of stop", pid)
|
||||
}
|
||||
checkPID(t, profile)
|
||||
pid = checkPID(t, profile)
|
||||
|
||||
// cancel the shutdown and make sure minikube is still running after 8 seconds
|
||||
// sleep 12 just to be safe
|
||||
stopMinikube(ctx, t, profile, []string{"--cancel-scheduled"})
|
||||
time.Sleep(12 * time.Second)
|
||||
time.Sleep(25 * 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"})
|
||||
stopMinikube(ctx, t, profile, []string{"--schedule", "15s"})
|
||||
time.Sleep(15 * time.Second)
|
||||
if processRunning(t, pid) {
|
||||
t.Fatalf("process %v running but should have been killed on reschedule of stop", pid)
|
||||
}
|
||||
|
||||
// wait for stop to complete
|
||||
time.Sleep(25 * time.Second)
|
||||
time.Sleep(30 * time.Second)
|
||||
// make sure minikube timetoStop is not present
|
||||
ensureTimeToStopNotPresent(ctx, t, profile)
|
||||
// make sure minikube status is "Stopped"
|
||||
|
|
Loading…
Reference in New Issue