Skip to content

Commit 7dc7cbf

Browse files
test
1 parent 41c3616 commit 7dc7cbf

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

hack/prow/common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ echo $PATH
176176
gotestsum --jsonfile "${JSON_OUT}" --junitfile="${JUNIT_OUT}" -f standard-verbose --raw-command -- \
177177
go tool test2json -t \
178178
${E2E_BIN} \
179+
-test.run TestScheduledStopUnix \
179180
-minikube-start-args="--driver=${DRIVER} ${EXTRA_START_ARGS}" \
180181
-test.timeout=${TIMEOUT} -test.v \
181182
${EXTRA_TEST_ARGS} \

out.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go build -tags "libvirt_dlopen" -ldflags="-X k8s.io/minikube/pkg/version.version=v1.37.0 -X k8s.io/minikube/pkg/version.isoVersion=v1.37.0-1762018871-21834 -X k8s.io/minikube/pkg/version.gitCommitID="8f3cadfdfdc7d39f951f3d645b177c153316cc08-dirty" -X k8s.io/minikube/pkg/version.storageProvisionerVersion=v5" -o out/minikube k8s.io/minikube/cmd/minikube

pkg/minikube/schedule/daemonize_unix.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424
"strconv"
25+
"syscall"
2526
"time"
2627

2728
"github.com/VividCortex/godaemon"
@@ -38,11 +39,13 @@ import (
3839
func KillExisting(profiles []string, options *run.CommandOptions) {
3940
for _, profile := range profiles {
4041
if err := killPIDForProfile(profile); err != nil {
42+
fmt.Printf("error killing PID for profile %s: %v\n", profile, err)
4143
klog.Warningf("error killng PID for profile %s: %v", profile, err)
4244
}
4345
_, cc := mustload.Partial(profile, options)
4446
cc.ScheduledStop = nil
4547
if err := config.SaveProfile(profile, cc); err != nil {
48+
fmt.Printf("error saving profile for profile %s: %v\n", profile, err)
4649
klog.Errorf("error saving profile for profile %s: %v", profile, err)
4750
}
4851
}
@@ -71,9 +74,21 @@ func killPIDForProfile(profile string) error {
7174
return errors.Wrap(err, "finding process")
7275
}
7376
klog.Infof("killing process %v as it is an old scheduled stop", pid)
77+
7478
if err := p.Kill(); err != nil {
79+
klog.Errorf("error killing %v: %v", pid, err)
80+
fmt.Printf("error killing %v: %v\n", pid, err)
7581
return errors.Wrapf(err, "killing %v", pid)
7682
}
83+
for i := 0; i < 50; i++ {
84+
err := p.Signal(syscall.Signal(0))
85+
if err != nil {
86+
klog.Infof("process %v has exited", pid)
87+
fmt.Printf("process %v has exited\n", pid)
88+
return nil
89+
}
90+
time.Sleep(100 * time.Millisecond)
91+
}
7792
return nil
7893
}
7994

test/integration/scheduled_stop_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func TestScheduledStopUnix(t *testing.T) {
9393
}
9494

9595
// schedule a second stop which should cancel the first scheduled stop
96-
stopMinikube(ctx, t, profile, []string{"--schedule", "15s"})
96+
stopMinikube(ctx, t, profile, []string{"--schedule", "15s","-v=5","--alsologtostderr"})
9797
if processRunning(t, pid) {
9898
t.Fatalf("process %v running but should have been killed on reschedule of stop", pid)
9999
}
@@ -138,6 +138,9 @@ func stopMinikube(ctx context.Context, t *testing.T, profile string, additionalA
138138
if err != nil {
139139
t.Fatalf("stopping minikube: %v\n%s", err, rr.Output())
140140
}
141+
fmt.Println("minikube stop output:")
142+
fmt.Println(rr.Output())
143+
141144
}
142145

143146
func checkPID(t *testing.T, profile string) string {

0 commit comments

Comments
 (0)