From 9b9789c207d8b84ee37e9c37c613879369a8690c Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Mon, 24 Feb 2020 11:21:15 -0500 Subject: Fix cgroupsv2 run test, unexpected output Sometime between 10th and 23rd of Feb. 2020, the behavior of crun changed. Upon consulting with Giuseppe, the podman run tests for `device-read-*` and `device-write-*` do not depend on the container output for success, only the exit code. Add a comment and conditional regarding this in case of cgroupsv2. Also noted that these tests will likely require future refactoring/simplification. Signed-off-by: Chris Evich --- test/e2e/run_memory_test.go | 6 +++++- test/e2e/run_test.go | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index a45735a8a..d60f2a8cd 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -70,7 +70,11 @@ var _ = Describe("Podman run memory", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(Equal("41943040")) + if cgroupsv2 { + Expect(session.OutputToString()).To(Equal("max")) + } else { + Expect(session.OutputToString()).To(Equal("41943040")) + } }) It("podman run memory-swappiness test", func() { diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 3eb93b84a..9b6de6f65 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -374,7 +374,9 @@ var _ = Describe("Podman run", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("1048576")) + if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 + Expect(session.OutputToString()).To(ContainSubstring("1048576")) + } }) It("podman run device-write-bps test", func() { @@ -392,7 +394,9 @@ var _ = Describe("Podman run", func() { } session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("1048576")) + if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 + Expect(session.OutputToString()).To(ContainSubstring("1048576")) + } }) It("podman run device-read-iops test", func() { @@ -411,7 +415,9 @@ var _ = Describe("Podman run", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("100")) + if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 + Expect(session.OutputToString()).To(ContainSubstring("100")) + } }) It("podman run device-write-iops test", func() { @@ -430,7 +436,9 @@ var _ = Describe("Podman run", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("100")) + if !cgroupsv2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2 + Expect(session.OutputToString()).To(ContainSubstring("100")) + } }) It("podman run notify_socket", func() { -- cgit v1.2.3-54-g00ecf From 9f69c4ecafca52e986fe7469d9087131a082a432 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 29 Jan 2020 11:08:43 -0500 Subject: System Tests: Force default signal handlers Recommended as part of: https://github.com/containers/libpod/issues/5004 and https://github.com/containers/crun/issues/230 Signed-off-by: Chris Evich --- test/system/130-kill.bats | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index 5e098d754..e6a77222a 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -8,7 +8,14 @@ load helpers @test "podman kill - test signal handling in containers" { # Start a container that will handle all signals by emitting 'got: N' local -a signals=(1 2 3 4 5 6 8 10 12 13 14 15 16 20 21 22 23 24 25 26 64) - run_podman run -d $IMAGE sh -c "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; echo READY; while ! test -e /stop; do sleep 0.05; done;echo DONE" + # The --default-signal option not available in busybox implementation of 'env' in $IMAGE + # needed here to ensure handling of SIGINT inside container uses the default handler + _IMAGE=quay.io/libpod/fedora-minimal:latest + run_podman run -d $_IMAGE env --default-signal sh -c \ + "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; + echo READY; + while ! test -e /stop; do sleep 0.05; done; + echo DONE" cid="$output" # Run 'logs -f' on that container, but run it in the background with -- cgit v1.2.3-54-g00ecf From 4511e15f8cde510e2224ac3d090f51fa120359bd Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Mon, 24 Feb 2020 12:33:44 -0500 Subject: Fix kill test obtaining CID It's possible/likely the container image for the test will need to be pulled as part of the `run` command. Due to the way BATS handles output, messages regarding image-pull could be misinterpreted as the container's CID. Force the CID to be obtained by only the last line of output. Signed-off-by: Chris Evich --- test/system/130-kill.bats | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index e6a77222a..8085b171e 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -16,7 +16,8 @@ load helpers echo READY; while ! test -e /stop; do sleep 0.05; done; echo DONE" - cid="$output" + # Ignore output regarding pulling/processing container images + cid=$(echo "$output" | tail -1) # Run 'logs -f' on that container, but run it in the background with # redirection to a named pipe from which we (foreground job) read -- cgit v1.2.3-54-g00ecf