From 4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 7 Jul 2022 14:06:05 +0200 Subject: machine test: fix endless loop in test The problem is that this could loop forever as long as podman start doe snot exit (which could happen due bugs). Also since there no timeout between the machine list calls the test is using the full cpu and this causes the system to slow down making the machine start command even slower. IMO it is enough to only check the status every three seconds. Signed-off-by: Paul Holzinger --- pkg/machine/e2e/list_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkg/machine/e2e') diff --git a/pkg/machine/e2e/list_test.go b/pkg/machine/e2e/list_test.go index e2121e7bf..f12fcbd11 100644 --- a/pkg/machine/e2e/list_test.go +++ b/pkg/machine/e2e/list_test.go @@ -2,6 +2,7 @@ package e2e import ( "strings" + "time" "github.com/containers/common/pkg/util" "github.com/containers/podman/v4/cmd/podman/machine" @@ -87,7 +88,7 @@ var _ = Describe("podman machine list", func() { startSession, err := mb.setCmd(s).runWithoutWait() Expect(err).To(BeNil()) l := new(listMachine) - for { // needs to be infinite because we need to check if running when inspect returns to avoid race conditions. + for i := 0; i < 30; i++ { listSession, err := mb.setCmd(l).run() Expect(listSession).To(Exit(0)) Expect(err).To(BeNil()) @@ -96,6 +97,7 @@ var _ = Describe("podman machine list", func() { } else { break } + time.Sleep(3 * time.Second) } Expect(startSession).To(Exit(0)) listSession, err := mb.setCmd(l).run() -- cgit v1.2.3-54-g00ecf