diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/20-containers.at | 2 | ||||
-rwxr-xr-x | test/buildah-bud/apply-podman-deltas | 25 | ||||
-rw-r--r-- | test/buildah-bud/buildah-tests.diff | 32 | ||||
-rw-r--r-- | test/e2e/events_test.go | 2 | ||||
-rw-r--r-- | test/e2e/network_create_test.go | 2 | ||||
-rw-r--r-- | test/e2e/network_test.go | 2 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 39 | ||||
-rw-r--r-- | test/system/090-events.bats | 13 | ||||
-rw-r--r-- | test/system/200-pod.bats | 34 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 5 | ||||
-rw-r--r-- | test/upgrade/test-upgrade.bats | 13 |
11 files changed, 140 insertions, 29 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 936597f72..3d67650d2 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -177,7 +177,7 @@ t GET libpod/containers/myctr/json 200 \ .ResolvConfPath=$userdata_path/resolv.conf \ .HostnamePath=$userdata_path/hostname \ .HostsPath=$userdata_path/hosts \ - .NetworkSettings.SandboxKey~.*/netns/cni- \ + .NetworkSettings.SandboxKey~.*/netns/netns- \ .OCIConfigPath~.*config\.json \ .GraphDriver.Data.MergedDir~.*merged diff --git a/test/buildah-bud/apply-podman-deltas b/test/buildah-bud/apply-podman-deltas index e42c8aa52..dd5331091 100755 --- a/test/buildah-bud/apply-podman-deltas +++ b/test/buildah-bud/apply-podman-deltas @@ -112,6 +112,7 @@ function skip_if_remote() { ############################################################################### # BEGIN differences in error messages between buildah and podman + errmsg "non-directory/Dockerfile: not a directory" \ "Error: context must be a directory:" \ "bud with a path to a Dockerfile (-f) containing a non-directory entry" @@ -177,7 +178,9 @@ skip_if_remote "--runtime not meaningful under podman-remote" \ skip_if_remote "secret files not implemented under podman-remote" \ "bud with containerfile secret" \ "bud with containerfile secret accessed on second RUN" \ - "bud with containerfile secret options" + "bud with containerfile secret options" \ + "bud with containerfile env secret" \ + "bud with containerfile env secret priority" skip_if_remote "volumes don't work with podman-remote" \ "buildah bud --volume" \ @@ -188,18 +191,20 @@ skip_if_remote "--stdin option will not be implemented in podman-remote" \ "bud test no --stdin" ############################################################################### -# BEGIN tests which are skipped due to actual podman-remote bugs. +# BEGIN tests which are skipped due to actual podman or podman-remote bugs. -############################################################################### -# BEGIN emergency handling of github git-protocol shutdown -# -# Please remove this as soon as we vendor buildah with #3701 +skip_if_remote "Podman #12838: different error messages" \ + "bud with .dockerignore #2" + +# These two tests, new in 2022-01, invoke podman (create, export) in ways +# that don't work with podman-remote due to the use of --registries-conf +skip_if_remote "FIXME FIXME FIXME: find a way to clean up their podman calls" \ + "bud with run should not leave mounts behind cleanup test" \ + "bud with custom files in /run/ should persist cleanup test" -skip "emergency workaround until buildah #3701 gets vendored in" \ - "bud-git-context" \ - "bud using gitrepo and branch" +skip_if_remote "Do envariables work with -remote? Please look into this." \ + "build proxy" -# END emergency handling of github git-protocol shutdown ############################################################################### # Done. diff --git a/test/buildah-bud/buildah-tests.diff b/test/buildah-bud/buildah-tests.diff index 87923484f..b1a19a522 100644 --- a/test/buildah-bud/buildah-tests.diff +++ b/test/buildah-bud/buildah-tests.diff @@ -1,15 +1,15 @@ -From 5baab334cac9853c1d4bae9466d46dbbe5ff7158 Mon Sep 17 00:00:00 2001 +From c18638abfbc1066442cf6ff0b3f012a5c25a918e Mon Sep 17 00:00:00 2001 From: Ed Santiago <santiago@redhat.com> Date: Tue, 9 Feb 2021 17:28:05 -0700 Subject: [PATCH] tweaks for running buildah tests under podman Signed-off-by: Ed Santiago <santiago@redhat.com> --- - tests/helpers.bash | 71 +++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 67 insertions(+), 4 deletions(-) + tests/helpers.bash | 72 +++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/tests/helpers.bash b/tests/helpers.bash -index 166316d5..775d7c9b 100644 +index bd2794c9..ecf6ed7d 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash @@ -43,6 +43,23 @@ EOF @@ -36,9 +36,9 @@ index 166316d5..775d7c9b 100644 } function starthttpd() { -@@ -84,6 +101,12 @@ function teardown(){ - function teardown_tests() { +@@ -85,6 +102,12 @@ function teardown_tests() { stophttpd + stop_git_daemon + if [[ -n "$PODMAN_SERVER_PID" ]]; then + kill $PODMAN_SERVER_PID @@ -49,7 +49,7 @@ index 166316d5..775d7c9b 100644 # Workaround for #1991 - buildah + overlayfs leaks mount points. # Many tests leave behind /var/tmp/.../root/overlay and sub-mounts; # let's find those and clean them up, otherwise 'rm -rf' fails. -@@ -156,7 +179,13 @@ function copy() { +@@ -157,7 +180,13 @@ function copy() { } function podman() { @@ -64,7 +64,7 @@ index 166316d5..775d7c9b 100644 } ################# -@@ -191,15 +220,40 @@ function run_buildah() { +@@ -192,15 +221,41 @@ function run_buildah() { --retry) retry=3; shift;; # retry network flakes esac @@ -86,9 +86,10 @@ index 166316d5..775d7c9b 100644 + _opts= + fi + -+ # podman always exits 125 where buildah exits 1 or 2 ++ # podman always exits 125 where buildah exits 1 or 2 (or, in the ++ # case of git, 128, which is a bug in git, but I won't harp on that). + case $expected_rc in -+ 1|2) expected_rc=125 ;; ++ 1|2|128) expected_rc=125 ;; + esac + fi + local cmd_basename=$(basename ${podman_or_buildah}) @@ -108,11 +109,10 @@ index 166316d5..775d7c9b 100644 # without "quotes", multiple lines are glommed together into one if [ -n "$output" ]; then echo "$output" -@@ -477,3 +531,12 @@ function skip_if_no_docker() { - skip "this test needs actual docker, not podman-docker" +@@ -499,6 +554,15 @@ function skip_if_no_docker() { fi } -+ + +#################### +# skip_if_remote # (only applicable for podman) +#################### @@ -121,6 +121,10 @@ index 166316d5..775d7c9b 100644 + skip "${1:-test does not work with podman-remote}" + fi +} ++ + function start_git_daemon() { + daemondir=${TESTDIR}/git-daemon + mkdir -p ${daemondir}/repo -- -2.25.1 +2.34.1 diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 39f495460..3b5b8ac6c 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -62,6 +62,8 @@ var _ = Describe("Podman events", func() { result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events") + date := time.Now().Format("2006-01-02") + Expect(result.OutputToStringArray()).To(ContainElement(HavePrefix(date)), "event log has correct timestamp") }) It("podman events with an event filter and container=cid", func() { diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index c9e13e7d2..194510f32 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -5,7 +5,7 @@ import ( "net" "os" - "github.com/containers/podman/v3/libpod/network/types" + "github.com/containers/common/libnetwork/types" . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" . "github.com/onsi/ginkgo" diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 424561943..1c99d0f36 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -6,7 +6,7 @@ import ( "os" "time" - "github.com/containers/podman/v3/libpod/network/types" + "github.com/containers/common/libnetwork/types" "github.com/containers/podman/v3/pkg/rootless" . "github.com/containers/podman/v3/test/utils" "github.com/containers/storage/pkg/stringid" diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index fab107af8..623377ea1 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -1029,4 +1029,43 @@ ENTRYPOINT ["sleep","99999"] Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile)) }) + + It("podman pod create --sysctl test", func() { + SkipIfRootless("Network sysctls are not available root rootless") + podCreate := podmanTest.Podman([]string{"pod", "create", "--sysctl", "net.core.somaxconn=65535"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + session := podmanTest.Podman([]string{"run", "--pod", podCreate.OutputToString(), "--rm", ALPINE, "sysctl", "net.core.somaxconn"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(ContainSubstring("net.core.somaxconn = 65535")) + + // if not sharing the net NS, nothing should fail, but the sysctl should not be passed + podCreate = podmanTest.Podman([]string{"pod", "create", "--share", "pid", "--sysctl", "net.core.somaxconn=65535"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + session = podmanTest.Podman([]string{"run", "--pod", podCreate.OutputToString(), "--rm", ALPINE, "sysctl", "net.core.somaxconn"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).NotTo(ContainSubstring("net.core.somaxconn = 65535")) + + // one other misc option + podCreate = podmanTest.Podman([]string{"pod", "create", "--sysctl", "kernel.msgmax=65535"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + session = podmanTest.Podman([]string{"run", "--pod", podCreate.OutputToString(), "--rm", ALPINE, "sysctl", "kernel.msgmax"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(ContainSubstring("kernel.msgmax = 65535")) + + podCreate = podmanTest.Podman([]string{"pod", "create", "--share", "pid", "--sysctl", "kernel.msgmax=65535"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + session = podmanTest.Podman([]string{"run", "--pod", podCreate.OutputToString(), "--rm", ALPINE, "sysctl", "kernel.msgmax"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).NotTo(ContainSubstring("kernel.msgmax = 65535")) + + }) + }) diff --git a/test/system/090-events.bats b/test/system/090-events.bats index 5af6a3793..a0b0380a2 100644 --- a/test/system/090-events.bats +++ b/test/system/090-events.bats @@ -116,3 +116,16 @@ function _events_disjunctive_filters() { @test "events with disjunctive filters - default" { _events_disjunctive_filters "" } + +@test "events with events_logfile_path in containers.conf" { + skip_if_remote "remote does not support --events-backend" + events_file=$PODMAN_TMPDIR/events.log + containersconf=$PODMAN_TMPDIR/containers.conf + cat >$containersconf <<EOF +[engine] +events_logfile_path="$events_file" +EOF + CONTAINERS_CONF="$containersconf" run_podman --events-backend=file pull $IMAGE + run cat $events_file + is "$output" ".*\"Name\":\"$IMAGE" "test" +} diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index 4a3337e57..51fcea104 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -362,4 +362,38 @@ EOF run_podman run --rm --pod "new:$pod_name" $IMAGE hostname is "$output" "$pod_name" "new:POD should have hostname name set to podname" } + +@test "podman rm --force to remove infra container" { + local pod_name="$(random_string 10 | tr A-Z a-z)" + run_podman create --pod "new:$pod_name" $IMAGE + container_ID="$output" + run_podman pod inspect --format "{{.InfraContainerID}}" $pod_name + infra_ID="$output" + + run_podman 125 container rm $infra_ID + is "$output" ".* and cannot be removed without removing the pod" + run_podman 125 container rm --force $infra_ID + is "$output" ".* and cannot be removed without removing the pod" + + run_podman container rm --depend $infra_ID + is "$output" ".*$infra_ID.*" + is "$output" ".*$container_ID.*" + + # Now make sure that --force --all works as well + run_podman create --pod "new:$pod_name" $IMAGE + container_1_ID="$output" + run_podman create --pod "$pod_name" $IMAGE + container_2_ID="$output" + run_podman create $IMAGE + container_3_ID="$output" + run_podman pod inspect --format "{{.InfraContainerID}}" $pod_name + infra_ID="$output" + + run_podman container rm --force --all $infraID + is "$output" ".*$infra_ID.*" + is "$output" ".*$container_1_ID.*" + is "$output" ".*$container_2_ID.*" + is "$output" ".*$container_3_ID.*" +} + # vim: filetype=sh diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index c49727cc9..c47679904 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -276,4 +276,9 @@ LISTEN_FDNAMES=listen_fdnames" | sort) is "$output" ".*--template cannot be set" "Error message should be '--template requires --new'" } +@test "podman --cgroup=cgroupfs doesn't show systemd warning" { + DBUS_SESSION_BUS_ADDRESS= run_podman --log-level warning --cgroup-manager=cgroupfs info -f '' + is "$output" "" "output should be empty" +} + # vim: filetype=sh diff --git a/test/upgrade/test-upgrade.bats b/test/upgrade/test-upgrade.bats index c0d601586..5d2435ab9 100644 --- a/test/upgrade/test-upgrade.bats +++ b/test/upgrade/test-upgrade.bats @@ -113,6 +113,7 @@ while :;do echo STOPPING podman \$opts stop -t 0 myrunningcontainer || true podman \$opts rm -f myrunningcontainer || true + podman \$opts network rm -f mynetwork exit 0 fi sleep 0.5 @@ -132,6 +133,9 @@ EOF $PODMAN run --rm --mac-address 78:28:a6:8d:24:8a --network $netname $OLD_PODMAN true $PODMAN network rm -f $netname + # Podman 4.0 might no longer use cni so /run/cni and /run/containers will no be created in this case + mkdir -p /run/cni /run/containers + # # Use new-podman to run the above script under old-podman. @@ -177,6 +181,13 @@ EOF : } +@test "info" { + # check network backend, since this is a old version we should use CNI + # when we start testing from 4.0 we should have netavark as backend + run_podman info --format '{{.Host.NetworkBackend}}' + is "$output" "cni" "correct network backend" +} + @test "images" { run_podman images -a --format '{{.Names}}' is "$output" "\[$IMAGE\]" "podman images" @@ -329,8 +340,6 @@ failed | exited | 17 run_podman logs podman_parent run_podman rm -f podman_parent - run_podman network rm -f mynetwork - umount $PODMAN_UPGRADE_WORKDIR/root/overlay || true rm -rf $PODMAN_UPGRADE_WORKDIR |