From 3bae26ae58b7b0e8c11adec2358fe0da19c44251 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 10 Jul 2023 13:42:41 +0200 Subject: [PATCH] Check dbus error on container runtime start/stop We should evaluate the error, otherwise we risk to hang indefinately on waiting for the `reschan` in: https://github.com/kubernetes/kubernetes/blob/64939b66c65b7c3daac41ece56776582532bf94b/test/e2e_node/util.go#L419 We also increase the timeout, because it can take a bit longer for runtimes to determinate depending on the work they have to be done on running containers. Signed-off-by: Sascha Grunert --- test/e2e_node/util.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e_node/util.go b/test/e2e_node/util.go index d98f8325f09..8c2a15bbb04 100644 --- a/test/e2e_node/util.go +++ b/test/e2e_node/util.go @@ -393,7 +393,7 @@ const ( ) 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() conn, err := dbus.NewWithContext(ctx) @@ -409,12 +409,13 @@ func performContainerRuntimeUnitOp(op containerRuntimeUnitOp) error { switch op { case startContainerRuntimeUnitOp: - conn.StartUnitContext(ctx, containerRuntimeUnitName, "replace", reschan) + _, err = conn.StartUnitContext(ctx, containerRuntimeUnitName, "replace", reschan) case stopContainerRuntimeUnitOp: - conn.StopUnitContext(ctx, containerRuntimeUnitName, "replace", reschan) + _, err = conn.StopUnitContext(ctx, containerRuntimeUnitName, "replace", reschan) default: framework.Failf("Unexpected container runtime op: %v", op) } + framework.ExpectNoError(err, "dbus connection error") job := <-reschan framework.ExpectEqual(job, "done", "Expected job to complete with done")