aboutsummaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2021-10-26 16:30:17 -0400
committerMatthew Heon <matthew.heon@pm.me>2021-11-12 11:08:25 -0500
commit2b85684ad1d2de0f412831e6225c176e0519bca3 (patch)
tree5fe6263a22258bd2b1f2e3beec7e064733142937 /test/e2e
parent0e1f67b725088c4d7425f56e260ddbb44078d11b (diff)
downloadpodman-2b85684ad1d2de0f412831e6225c176e0519bca3.tar.gz
podman-2b85684ad1d2de0f412831e6225c176e0519bca3.tar.bz2
podman-2b85684ad1d2de0f412831e6225c176e0519bca3.zip
Fix systemd PID1 test
Previously this test used an ad-hoc timeout mechanism to synchronize with output of the container ID. However, depending on runtime conditions this may not correctly correspond with complete startup of the systemd process. Consequently this test fails under some conditions with an error like: `System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down` Fix this by using the more appropriate `WaitContainerReady()` against output from system startup, close to finalization. In this way, the test status command cannot run until systemd is fully operational. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/systemd_test.go17
1 files changed, 1 insertions, 16 deletions
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index a1b25b723..98def3d8f 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -4,7 +4,6 @@ import (
"io/ioutil"
"os"
"strings"
- "time"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
@@ -82,27 +81,13 @@ WantedBy=multi-user.target
run := podmanTest.Podman([]string{"run", "--name", ctrName, "-t", "-i", "-d", ubi_init, "/sbin/init"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
- ctrID := run.OutputToString()
logs := podmanTest.Podman([]string{"logs", ctrName})
logs.WaitWithDefaultTimeout()
Expect(logs).Should(Exit(0))
// Give container 10 seconds to start
- started := false
- for i := 0; i < 10; i++ {
- runningCtrs := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
- runningCtrs.WaitWithDefaultTimeout()
- Expect(runningCtrs).Should(Exit(0))
-
- if strings.Contains(runningCtrs.OutputToString(), ctrID) {
- started = true
- break
- }
-
- time.Sleep(1 * time.Second)
- }
-
+ started := podmanTest.WaitContainerReady(ctrName, "Reached target Multi-User System.", 30, 1)
Expect(started).To(BeTrue())
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"})