diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/12-imagesMore.at | 2 | ||||
-rwxr-xr-x | test/buildah-bud/apply-podman-deltas | 13 | ||||
-rwxr-xr-x | test/buildah-bud/run-buildah-bud-tests | 9 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 29 | ||||
-rw-r--r-- | test/system/001-basic.bats | 11 | ||||
-rw-r--r-- | test/system/010-images.bats | 6 | ||||
-rw-r--r-- | test/system/120-load.bats | 1 | ||||
-rw-r--r-- | test/system/170-run-userns.bats | 4 | ||||
-rw-r--r-- | test/system/200-pod.bats | 2 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 27 | ||||
-rw-r--r-- | test/system/251-system-service.bats | 58 |
11 files changed, 119 insertions, 43 deletions
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at index fc18dd2d7..d4b09174f 100644 --- a/test/apiv2/12-imagesMore.at +++ b/test/apiv2/12-imagesMore.at @@ -63,7 +63,7 @@ podman pull -q $IMAGE podman system connection add --default test ssh://$USER@localhost/run/user/$UID/podman/podman.sock # should fail but need to check the output... # status 125 here means that the save/load fails due to -# cirrus weirdness with exec.Command. All of the args have been parsed sucessfully. +# cirrus weirdness with exec.Command. All of the args have been parsed successfully. t POST "libpod/images/scp/$IMAGE?destination=QA::" 500 \ .cause="exit status 125" t DELETE libpod/images/$IMAGE 200 \ diff --git a/test/buildah-bud/apply-podman-deltas b/test/buildah-bud/apply-podman-deltas index 0b691dd0e..d6d539fa4 100755 --- a/test/buildah-bud/apply-podman-deltas +++ b/test/buildah-bud/apply-podman-deltas @@ -129,10 +129,10 @@ errmsg "no such file or directory" \ errmsg "no such file or directory" \ "Error: no context directory and no Containerfile specified" \ - "bud without any arguments should fail when no Dockerfile exist" + "bud without any arguments should fail when no Dockerfile exists" errmsg "is not a file" \ - "Error: open .*: no such file or directory" \ + "Error: containerfile: .* cannot be path to a directory" \ "bud with specified context should fail if assumed Dockerfile is a directory" errmsg "no such file or directory" \ @@ -197,7 +197,7 @@ skip_if_remote "--build-context option not implemented in podman-remote" \ "build-with-additional-build-context and COPY, additional context from host" \ "build-with-additional-build-context and RUN --mount=from=, additional-context not image and also test conflict with stagename" \ -skip_if_remote "env-variable for Containerfile.in pre-processing is not propogated on remote" \ +skip_if_remote "env-variable for Containerfile.in pre-processing is not propagated on remote" \ "bud with Containerfile.in, via envariable" \ # Requires a local file outside context dir @@ -215,7 +215,8 @@ skip_if_remote "--output option not implemented in podman-remote" \ "build with custom build output and output rootfs to directory" \ "build with custom build output and output rootfs to tar" \ "build with custom build output and output rootfs to tar by pipe" \ - "build with custom build output must fail for bad input" + "build with custom build output must fail for bad input" \ + "build with custom build output and output rootfs to tar with no additional step" # https://github.com/containers/podman/issues/14544 skip_if_remote "logfile not implemented on remote" "bud-logfile-with-split-logfile-by-platform" @@ -223,6 +224,10 @@ skip_if_remote "logfile not implemented on remote" "bud-logfile-with-split-logfi skip_if_remote "envariables do not automatically work with -remote." \ "build proxy" +# 2022-07-04 this is a new test in buildah; it's failing in treadmill +skip_if_remote "FIXME FIXME FIXME: does this test make sense in remote?" \ + "build-test with OCI prestart hook" + ############################################################################### # BEGIN tests which are skipped due to actual podman or podman-remote bugs. diff --git a/test/buildah-bud/run-buildah-bud-tests b/test/buildah-bud/run-buildah-bud-tests index 4ff062496..d0e2e3237 100755 --- a/test/buildah-bud/run-buildah-bud-tests +++ b/test/buildah-bud/run-buildah-bud-tests @@ -94,10 +94,13 @@ fi set -e # Run sudo early, to refresh the credentials cache. This is a NOP under CI, -# but might be appreciated by developers who run this script, step away +# but might be appreciated by developers who run this script, step away # during the git-checkout-buildah step, then come back twenty minutes later -# to an expired sudo prompt and no tests have run. -sudo --validate +# to an expired sudo prompt and no tests have run. (No need to do this +# for checkout; only when running tests) +if [[ -n $do_test ]]; then + sudo --validate +fi # Before pulling buildah (while still cd'ed to podman repo), try to determine # if this is a PR, and if so if it's a revendoring of buildah. We use this to diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 457aaebb2..9e2d4de19 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1559,8 +1559,10 @@ var _ = Describe("Podman play kube", func() { }) // If you have an init container in the pod yaml, podman should create and run the init container with play kube - It("podman play kube test with init containers", func() { - pod := getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(ALPINE), withCmd([]string{"top"})))) + // With annotation set to always + It("podman play kube test with init containers and annotation set", func() { + // With the init container type annotation set to always + pod := getPod(withAnnotation("io.podman.annotations.init.container.type", "always"), withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(ALPINE), withCmd([]string{"top"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(BeNil()) @@ -1585,6 +1587,29 @@ var _ = Describe("Podman play kube", func() { Expect(inspect.OutputToString()).To(ContainSubstring("running")) }) + // If you have an init container in the pod yaml, podman should create and run the init container with play kube + // Using default init container type (once) + It("podman play kube test with init container type set to default value", func() { + // Using the default init container type (once) + pod := getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(ALPINE), withCmd([]string{"top"})))) + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).Should(Exit(0)) + + // Expect the number of containers created to be 2, infra and regular container + numOfCtrs := podmanTest.NumberOfContainers() + Expect(numOfCtrs).To(Equal(2)) + + // Regular container should be in running state + inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-" + defaultCtrName}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + Expect(inspect.OutputToString()).To(ContainSubstring("running")) + }) + // If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied. It("podman play kube test correct command with only set args in yaml file", func() { pod := getPod(withCtr(getCtr(withImage(REGISTRY_IMAGE), withCmd(nil), withArg([]string{"echo", "hello"})))) diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats index 0d2a99d4b..cf37fc07c 100644 --- a/test/system/001-basic.bats +++ b/test/system/001-basic.bats @@ -61,8 +61,19 @@ function setup() { } @test "podman can pull an image" { + run_podman rmi -a run_podman pull $IMAGE + # Regression test for https://github.com/containers/image/pull/1615 + # Make sure no progress lines are duplicated + local -A line_seen + for line in "${lines[@]}"; do + if [[ -n "${line_seen[$line]}" ]]; then + die "duplicate podman-pull output line: $line" + fi + line_seen[$line]=1 + done + # Also make sure that the tag@digest syntax is supported. run_podman inspect --format "{{ .Digest }}" $IMAGE digest=$output diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 69ed1004c..638910302 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -259,8 +259,8 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z run_podman 2 rmi -a is "$output" "Error: 2 errors occurred: -.** Image used by .*: image is in use by a container -.** Image used by .*: image is in use by a container" +.** image used by .*: image is in use by a container +.** image used by .*: image is in use by a container" run_podman rmi -af is "$output" "Untagged: $IMAGE @@ -292,7 +292,7 @@ Deleted: $pauseID" "infra images gets removed as well" pauseID=$output run_podman 2 rmi $pauseImage - is "$output" "Error: Image used by .* image is in use by a container" + is "$output" "Error: image used by .* image is in use by a container" run_podman rmi -f $pauseImage is "$output" "Untagged: $pauseImage diff --git a/test/system/120-load.bats b/test/system/120-load.bats index 7f0bcfd95..8dcdd8bdd 100644 --- a/test/system/120-load.bats +++ b/test/system/120-load.bats @@ -158,6 +158,7 @@ verify_iid_and_name() { run_podman 125 image scp $nope ${notme}@localhost:: is "$output" "Error: $nope: image not known.*" "Pushing nonexistent image" + run_podman rmi foobar:123 } diff --git a/test/system/170-run-userns.bats b/test/system/170-run-userns.bats index 84788a7f4..2ad9eb0b8 100644 --- a/test/system/170-run-userns.bats +++ b/test/system/170-run-userns.bats @@ -124,7 +124,7 @@ EOF run_podman rm -t 0 --force ${cid} else run_podman 125 run -d --userns=nomap $IMAGE sleep 100 - is "${output}" "Error: nomap is only supported in rootless mode" "Container should fail to start since nomap is not suppored in rootful mode" + is "${output}" "Error: nomap is only supported in rootless mode" "Container should fail to start since nomap is not supported in rootful mode" fi } @@ -135,6 +135,6 @@ EOF is "${output}" "$user" "Container should run as the current user" else run_podman 125 run --rm --userns=keep-id $IMAGE id -u - is "${output}" "Error: keep-id is only supported in rootless mode" "Container should fail to start since keep-id is not suppored in rootful mode" + is "${output}" "Error: keep-id is only supported in rootless mode" "Container should fail to start since keep-id is not supported in rootful mode" fi } diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index b93f3f92f..7b7f5e8bb 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -322,7 +322,7 @@ EOF is "$output" "" "output from pod create should be empty" run_podman 125 pod create --infra-name "$infra_name" - assert "$output" =~ "^Error: .*: the container name \"$infra_name\" is already in use by .* You have to remove that container to be able to reuse that name.: that name is already in use" \ + assert "$output" =~ "^Error: .*: the container name \"$infra_name\" is already in use by .* You have to remove that container to be able to reuse that name: that name is already in use" \ "Trying to create two pods with same infra-name" run_podman pod rm -f $pod_name diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index fc3c33975..9a91501dd 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -296,8 +296,6 @@ LISTEN_FDNAMES=listen_fdnames" | sort) } @test "podman-kube@.service template" { - skip_if_remote "systemd units do not work with remote clients" - # If running from a podman source directory, build and use the source # version of the play-kube-@ unit file unit_name="podman-kube@.service" @@ -375,29 +373,4 @@ EOF rm -f $UNIT_DIR/$unit_name } -@test "podman-system-service containers survive service stop" { - skip_if_remote "N/A under podman-remote" - - SERVICE_NAME=podman-service-$(random_string) - port=$(random_free_port) - URL=tcp://127.0.0.1:$port - - systemd-run --unit=$SERVICE_NAME $PODMAN system service $URL --time=0 - wait_for_port 127.0.0.1 $port - - # Start a long-running container. - cname=keeps-running - run_podman --url $URL run -d --name $cname $IMAGE top -d 2 - - run_podman container inspect -l --format "{{.State.Running}}" - is "$output" "true" "This should never fail" - - systemctl stop $SERVICE_NAME - - run_podman container inspect $cname --format "{{.State.Running}}" - is "$output" "true" "Container is still running after podman server stops" - - run_podman rm -f -t 0 $cname -} - # vim: filetype=sh diff --git a/test/system/251-system-service.bats b/test/system/251-system-service.bats new file mode 100644 index 000000000..edee4a28c --- /dev/null +++ b/test/system/251-system-service.bats @@ -0,0 +1,58 @@ +#!/usr/bin/env bats -*- bats -*- +# +# Tests that require 'podman system service' but no other systemd aspects + +load helpers +load helpers.systemd + +SERVICE_NAME="podman-service-$(random_string)" + +function teardown() { + # Ignore exit status: this is just a backup stop in case tests failed + run systemctl stop "$SERVICE_NAME" + + basic_teardown +} + + +@test "podman-system-service containers survive service stop" { + skip_if_remote "podman system service unavailable over remote" + + port=$(random_free_port) + URL=tcp://127.0.0.1:$port + + systemd-run --unit=$SERVICE_NAME $PODMAN system service $URL --time=0 + wait_for_port 127.0.0.1 $port + + # Start a long-running container. + cname=keeps-running + run_podman --url $URL run -d --name $cname $IMAGE top -d 2 + + run_podman container inspect -l --format "{{.State.Running}}" + is "$output" "true" "This should never fail" + + systemctl stop $SERVICE_NAME + + run_podman container inspect $cname --format "{{.State.Running}}" + is "$output" "true" "Container is still running after podman server stops" + + run_podman rm -f -t 0 $cname +} + +# This doesn't actually test podman system service, but we require it, +# so least-awful choice is to run from this test file. +@test "podman --host / -H options" { + port=$(random_free_port) + URL=tcp://127.0.0.1:$port + + # %%-remote makes this run real podman even when testing podman-remote + systemd-run --unit=$SERVICE_NAME ${PODMAN%%-remote*} system service $URL --time=0 + wait_for_port 127.0.0.1 $port + + for opt in --host -H; do + run_podman $opt $URL info --format '{{.Host.RemoteSocket.Path}}' + is "$output" "$URL" "RemoteSocket.Path using $opt" + done + + systemctl stop $SERVICE_NAME +} |