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>
This commit is contained in:
Paul Holzinger
2022-07-07 14:06:05 +02:00
parent d481fbe759
commit 4cfa8ccb27

View File

@ -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()