diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-07-07 14:06:05 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-07-07 20:48:27 +0200 |
commit | 4cfa8ccb27ba642fc78b37fa733fcd0d6271ad0f (patch) | |
tree | 4576c4cd6c43c4143d6222a0d1fd1fce5b9c2f08 /pkg | |
parent | d481fbe7593b8b2ead4c77f6ceaaf2a233ef209b (diff) | |
download | podman-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')
-rw-r--r-- | pkg/machine/e2e/list_test.go | 4 |
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() |