mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Merge pull request #119197 from saschagrunert/stop-container-runtime-err
Check dbus error on container runtime start/stop
This commit is contained in:
commit
88d14edc26
@ -393,7 +393,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func performContainerRuntimeUnitOp(op containerRuntimeUnitOp) error {
|
func performContainerRuntimeUnitOp(op containerRuntimeUnitOp) error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
conn, err := dbus.NewWithContext(ctx)
|
conn, err := dbus.NewWithContext(ctx)
|
||||||
@ -409,12 +409,13 @@ func performContainerRuntimeUnitOp(op containerRuntimeUnitOp) error {
|
|||||||
|
|
||||||
switch op {
|
switch op {
|
||||||
case startContainerRuntimeUnitOp:
|
case startContainerRuntimeUnitOp:
|
||||||
conn.StartUnitContext(ctx, containerRuntimeUnitName, "replace", reschan)
|
_, err = conn.StartUnitContext(ctx, containerRuntimeUnitName, "replace", reschan)
|
||||||
case stopContainerRuntimeUnitOp:
|
case stopContainerRuntimeUnitOp:
|
||||||
conn.StopUnitContext(ctx, containerRuntimeUnitName, "replace", reschan)
|
_, err = conn.StopUnitContext(ctx, containerRuntimeUnitName, "replace", reschan)
|
||||||
default:
|
default:
|
||||||
framework.Failf("Unexpected container runtime op: %v", op)
|
framework.Failf("Unexpected container runtime op: %v", op)
|
||||||
}
|
}
|
||||||
|
framework.ExpectNoError(err, "dbus connection error")
|
||||||
|
|
||||||
job := <-reschan
|
job := <-reschan
|
||||||
framework.ExpectEqual(job, "done", "Expected job to complete with done")
|
framework.ExpectEqual(job, "done", "Expected job to complete with done")
|
||||||
|
Loading…
Reference in New Issue
Block a user