summaryrefslogtreecommitdiff
path: root/pkg/machine
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-07-07 14:06:05 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-07-07 20:48:27 +0200
commit4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f (patch)
tree4576c4cd6c43c4143d6222a0d1fd1fce5b9c2f08 /pkg/machine
parentd481fbe7593b8b2ead4c77f6ceaaf2a233ef209b (diff)
downloadpodman-4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f.tar.gz
podman-4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f.tar.bz2
podman-4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f.zip
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 <pholzing@redhat.com>
Diffstat (limited to 'pkg/machine')
-rw-r--r--pkg/machine/e2e/list_test.go4
1 files changed, 3 insertions, 1 deletions
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()