diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/ps_test.go | 22 | ||||
-rw-r--r-- | test/system/130-kill.bats | 17 |
2 files changed, 35 insertions, 4 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 362c7aabb..12bfdfe41 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -306,7 +306,29 @@ var _ = Describe("Podman ps", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring(podid)) + }) + + It("podman --pod with a non-empty pod name", func() { + SkipIfRemote() + + podName := "testPodName" + _, ec, podid := podmanTest.CreatePod(podName) + Expect(ec).To(Equal(0)) + + session := podmanTest.RunTopContainerInPod("", podName) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + // "--no-trunc" must be given. If not it will trunc the pod ID + // in the output and you will have to trunc it in the test too. + session = podmanTest.Podman([]string{"ps", "--pod", "--no-trunc"}) + + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + output := session.OutputToString() + Expect(output).To(ContainSubstring(podid)) + Expect(output).To(ContainSubstring(podName)) }) It("podman ps test with port range", func() { diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index af3409b9b..aae7f114f 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -16,10 +16,19 @@ load helpers # and confirm that signals are received. We can't use run_podman here. local fifo=${PODMAN_TMPDIR}/podman-kill-fifo.$(random_string 10) mkfifo $fifo - $PODMAN logs -f $cid >$fifo & + $PODMAN logs -f $cid >$fifo </dev/null & podman_log_pid=$! + + # Open the FIFO for reading, and keep it open. This prevents a race + # condition in which the container can exit (e.g. if for some reason + # it doesn't handle the signal) and we (this test) try to read from + # the FIFO. Since there wouldn't be an active writer, the open() + # would hang forever. With this exec we keep the FD open, allowing + # 'read -t' to time out and report a useful error. + exec 5<$fifo + # First container emits READY when ready; wait for it. - read -t 10 ready <$fifo + read -t 10 -u 5 ready is "$ready" "READY" "first log message from container" # Helper function: send the given signal, verify that it's received. @@ -28,7 +37,7 @@ load helpers local signum=${2:-$1} # e.g. if signal=HUP, we expect to see '1' run_podman kill -s $signal $cid - read -t 10 actual <$fifo + read -t 10 -u 5 actual || die "Timed out: no ACK for kill -s $signal" is "$actual" "got: $signum" "Signal $signal handled by container" } @@ -46,7 +55,7 @@ load helpers # Done. Tell the container to stop, and wait for final DONE run_podman exec $cid touch /stop - read -t 5 done <$fifo + read -t 5 -u 5 done || die "Timed out waiting for DONE from container" is "$done" "DONE" "final log message from container" # Clean up |