diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/12-imagesMore.at | 2 | ||||
-rw-r--r-- | test/apiv2/20-containers.at | 8 | ||||
-rw-r--r-- | test/apiv2/22-stop.at | 4 | ||||
-rw-r--r-- | test/apiv2/25-containersMore.at | 4 | ||||
-rw-r--r-- | test/apiv2/python/rest_api/test_v2_0_0_container.py | 2 | ||||
-rwxr-xr-x | test/buildah-bud/apply-podman-deltas | 10 | ||||
-rw-r--r-- | test/e2e/containers_conf_test.go | 32 | ||||
-rw-r--r-- | test/e2e/events_test.go | 2 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 10 | ||||
-rw-r--r-- | test/e2e/pull_test.go | 8 | ||||
-rw-r--r-- | test/system/001-basic.bats | 2 | ||||
-rw-r--r-- | test/system/010-images.bats | 4 | ||||
-rw-r--r-- | test/system/030-run.bats | 15 | ||||
-rw-r--r-- | test/system/035-logs.bats | 8 | ||||
-rw-r--r-- | test/system/050-stop.bats | 5 | ||||
-rw-r--r-- | test/system/055-rm.bats | 12 | ||||
-rw-r--r-- | test/system/080-pause.bats | 3 | ||||
-rw-r--r-- | test/system/090-events.bats | 13 | ||||
-rw-r--r-- | test/system/170-run-userns.bats | 16 | ||||
-rw-r--r-- | test/system/200-pod.bats | 11 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 5 | ||||
-rw-r--r-- | test/system/500-networking.bats | 6 |
22 files changed, 153 insertions, 29 deletions
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at index 3a5d5c096..96eba1db5 100644 --- a/test/apiv2/12-imagesMore.at +++ b/test/apiv2/12-imagesMore.at @@ -53,7 +53,7 @@ t GET libpod/images/$IMAGE/json 200 \ .RepoTags[-1]=$IMAGE # Remove the registry container -t DELETE libpod/containers/registry?force=true 204 +t DELETE libpod/containers/registry?force=true 200 # Remove images t DELETE libpod/images/$IMAGE 200 \ diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 554a905d4..936597f72 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -85,7 +85,7 @@ else fi fi -t DELETE libpod/containers/$cid 204 +t DELETE libpod/containers/$cid 200 .[0].Id=$cid # Issue #6799: it should be possible to start a container, even w/o args. t POST libpod/containers/create?name=test_noargs Image=${IMAGE} 201 \ @@ -100,7 +100,7 @@ t GET libpod/containers/${cid}/json 200 \ .State.Status~\\\(exited\\\|stopped\\\) \ .State.Running=false \ .State.ExitCode=0 -t DELETE libpod/containers/$cid 204 +t DELETE libpod/containers/$cid 200 .[0].Id=$cid CNAME=myfoo podman run -d --name $CNAME $IMAGE top @@ -190,8 +190,8 @@ t GET containers/myctr/json 200 \ t DELETE images/localhost/newrepo:latest?force=true 200 t DELETE images/localhost/newrepo:v1?force=true 200 t DELETE images/localhost/newrepo:v2?force=true 200 -t DELETE libpod/containers/$cid?force=true 204 -t DELETE libpod/containers/myctr 204 +t DELETE libpod/containers/$cid?force=true 200 .[0].Id=$cid +t DELETE libpod/containers/myctr 200 t DELETE libpod/containers/bogus 404 diff --git a/test/apiv2/22-stop.at b/test/apiv2/22-stop.at index 91bc9937d..bde534b72 100644 --- a/test/apiv2/22-stop.at +++ b/test/apiv2/22-stop.at @@ -11,7 +11,7 @@ podman run -dt --name mytop $IMAGE top &>/dev/null t GET libpod/containers/mytop/json 200 .State.Status=running t POST libpod/containers/mytop/stop 204 t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\) -t DELETE libpod/containers/mytop 204 +t DELETE libpod/containers/mytop 200 # stop, by ID # Remember that podman() hides all output; we need to get our CID via inspect @@ -21,4 +21,4 @@ t GET libpod/containers/mytop/json 200 .State.Status=running cid=$(jq -r .Id <<<"$output") t POST libpod/containers/$cid/stop 204 t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\) -t DELETE libpod/containers/mytop 204 +t DELETE libpod/containers/mytop 200 diff --git a/test/apiv2/25-containersMore.at b/test/apiv2/25-containersMore.at index 0a049d869..c9fda8c6f 100644 --- a/test/apiv2/25-containersMore.at +++ b/test/apiv2/25-containersMore.at @@ -51,7 +51,7 @@ like "$output" ".*merged" "Check container mount" # Unmount the container t POST libpod/containers/foo/unmount 204 -t DELETE libpod/containers/foo?force=true 204 +t DELETE libpod/containers/foo?force=true 200 podman run $IMAGE true @@ -79,7 +79,7 @@ like "$output" ".*metadata:.*" "Check generated kube yaml(service=true) - metada like "$output" ".*spec:.*" "Check generated kube yaml(service=true) - spec" like "$output" ".*kind:\\sService.*" "Check generated kube yaml(service=true) - kind: Service" -t DELETE libpod/containers/$cid 204 +t DELETE libpod/containers/$cid 200 .[0].Id=$cid # Create 3 stopped containers to test containers prune podman run $IMAGE true diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py index 101044bbb..1b4597cf8 100644 --- a/test/apiv2/python/rest_api/test_v2_0_0_container.py +++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py @@ -99,7 +99,7 @@ class ContainerTestCase(APITestCase): def test_delete(self): r = requests.delete(self.uri(self.resolve_container("/containers/{}?force=true"))) - self.assertEqual(r.status_code, 204, r.text) + self.assertEqual(r.status_code, 200, r.text) def test_stop(self): r = requests.post(self.uri(self.resolve_container("/containers/{}/start"))) diff --git a/test/buildah-bud/apply-podman-deltas b/test/buildah-bud/apply-podman-deltas index 44a33b0b8..e42c8aa52 100755 --- a/test/buildah-bud/apply-podman-deltas +++ b/test/buildah-bud/apply-podman-deltas @@ -191,6 +191,16 @@ skip_if_remote "--stdin option will not be implemented in podman-remote" \ # BEGIN tests which are skipped due to actual podman-remote bugs. ############################################################################### +# BEGIN emergency handling of github git-protocol shutdown +# +# Please remove this as soon as we vendor buildah with #3701 + +skip "emergency workaround until buildah #3701 gets vendored in" \ + "bud-git-context" \ + "bud using gitrepo and branch" + +# END emergency handling of github git-protocol shutdown +############################################################################### # Done. exit $RC diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index 2a6f177f2..838221dd5 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -452,4 +452,36 @@ var _ = Describe("Podman run", func() { Expect(result).Should(Exit(0)) Expect(result.OutputToString()).To(ContainSubstring("(default 1234)")) }) + + It("podman bad infra_image name in containers.conf", func() { + infra1 := "i.do/not/exist:image" + infra2 := "i.still.do/not/exist:image" + errorString := "initializing source docker://" + infra1 + error2String := "initializing source docker://" + infra2 + configPath := filepath.Join(podmanTest.TempDir, "containers.conf") + os.Setenv("CONTAINERS_CONF", configPath) + + containersConf := []byte("[engine]\ninfra_image=\"" + infra1 + "\"") + err = ioutil.WriteFile(configPath, containersConf, os.ModePerm) + Expect(err).To(BeNil()) + + if IsRemote() { + podmanTest.RestartRemoteService() + } + + result := podmanTest.Podman([]string{"pod", "create", "--infra-image", infra2}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(125)) + Expect(result.ErrorToString()).To(ContainSubstring(error2String)) + + result = podmanTest.Podman([]string{"pod", "create"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(125)) + Expect(result.ErrorToString()).To(ContainSubstring(errorString)) + + result = podmanTest.Podman([]string{"create", "--pod", "new:pod1", ALPINE}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(125)) + Expect(result.ErrorToString()).To(ContainSubstring(errorString)) + }) }) 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/play_kube_test.go b/test/e2e/play_kube_test.go index 1c7eb09a4..71bfd1e99 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1659,7 +1659,7 @@ var _ = Describe("Podman play kube", func() { inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) - Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`)) + Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) It("podman play kube test optional env value from missing configmap", func() { @@ -1674,7 +1674,7 @@ var _ = Describe("Podman play kube", func() { inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) - Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`)) + Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) It("podman play kube test get all key-value pairs from configmap as envs", func() { @@ -1768,7 +1768,7 @@ var _ = Describe("Podman play kube", func() { inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) - Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`)) + Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) It("podman play kube test optional env value from secret with missing key", func() { @@ -1784,7 +1784,7 @@ var _ = Describe("Podman play kube", func() { inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) - Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`)) + Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) It("podman play kube test get all key-value pairs from secret as envs", func() { @@ -3212,7 +3212,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) - Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`)) + Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) It("podman play kube uses all key-value pairs as envs", func() { diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index f22acca6e..38afff9bd 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -354,13 +354,13 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - session = podmanTest.Podman([]string{"pull", imgPath}) + session = podmanTest.Podman([]string{"run", imgPath, "ls"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - session = podmanTest.Podman([]string{"images"}) + // Note that reference is not preserved in dir. + session = podmanTest.Podman([]string{"image", "exists", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue()) + Expect(session).Should(Exit(1)) }) It("podman pull from local OCI directory", func() { diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats index 23489c1b5..9b0a71285 100644 --- a/test/system/001-basic.bats +++ b/test/system/001-basic.bats @@ -41,7 +41,7 @@ function setup() { # This one must fail run_podman 125 --context=swarm version is "$output" \ - "Error: Podman does not support swarm, the only --context value allowed is \"default\"" \ + "Error: podman does not support swarm, the only --context value allowed is \"default\"" \ "--context=default or fail" } diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 201418620..ebd71450f 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -272,6 +272,10 @@ Deleted: $pauseID" "infra images gets removed as well" is "$output" "" run_podman create --pod new:$pname $IMAGE + # Clean up + run_podman rm "${lines[-1]}" + run_podman pod rm -a + run_podman rmi $pauseImage } @test "podman images - rmi -f can remove infra images" { diff --git a/test/system/030-run.bats b/test/system/030-run.bats index feca5370b..afcda3d3c 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -509,6 +509,21 @@ json-file | f rm -f $new_runtime } +@test "podman --noout run should print output" { + run_podman --noout run -d --name test $IMAGE echo hi + is "$output" "" "output should be empty" + run_podman wait test + run_podman --noout rm test + is "$output" "" "output should be empty" +} + +@test "podman --noout create should print output" { + run_podman --noout create --name test $IMAGE echo hi + is "$output" "" "output should be empty" + run_podman --noout rm test + is "$output" "" "output should be empty" +} + # Regression test for issue #8082 @test "podman run : look up correct image name" { # Create a 2nd tag for the local image. Force to lower case, and apply it. diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats index 3caf97a22..db50c8f8c 100644 --- a/test/system/035-logs.bats +++ b/test/system/035-logs.bats @@ -90,14 +90,16 @@ ${cid[0]} d" "Sequential output from logs" } function _log_test_restarted() { - run_podman run --log-driver=$1 --name logtest $IMAGE sh -c 'start=0; if test -s log; then start=`tail -n 1 log`; fi; seq `expr $start + 1` `expr $start + 10` | tee -a log' + local driver=$1 + local events_backend=$(_additional_events_backend $driver) + run_podman run --log-driver=$driver ${events_backend} --name logtest $IMAGE sh -c 'start=0; if test -s log; then start=`tail -n 1 log`; fi; seq `expr $start + 1` `expr $start + 10` | tee -a log' # FIXME: #9597 # run/start is flaking for remote so let's wait for the container condition # to stop wasting energy until the root cause gets fixed. run_podman container wait --condition=exited logtest - run_podman start -a logtest + run_podman ${events_backend} start -a logtest logfile=$(mktemp -p ${PODMAN_TMPDIR} logfileXXXXXXXX) - $PODMAN $_PODMAN_TEST_OPTS logs -f logtest > $logfile + $PODMAN $_PODMAN_TEST_OPTS ${events_backend} logs -f logtest > $logfile expected=$(mktemp -p ${PODMAN_TMPDIR} expectedXXXXXXXX) seq 1 20 > $expected diff -u ${expected} ${logfile} diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats index e049da518..7dd8f98e8 100644 --- a/test/system/050-stop.bats +++ b/test/system/050-stop.bats @@ -173,4 +173,9 @@ load helpers is "$output" ".*StopSignal SIGTERM failed to stop container stopme in 1 seconds, resorting to SIGKILL" "stopping container should print warning" } +@test "podman stop --noout" { + run_podman run --rm --name stopme -d $IMAGE top + run_podman --noout stop -t 0 stopme + is "$output" "" "output should be empty" +} # vim: filetype=sh diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats index 7fe81c084..69663fafa 100644 --- a/test/system/055-rm.bats +++ b/test/system/055-rm.bats @@ -58,6 +58,18 @@ load helpers run_podman rm -af } +@test "podman rm --depend" { + run_podman create $IMAGE + dependCid=$output + run_podman create --net=container:$dependCid $IMAGE + cid=$output + run_podman 125 rm $dependCid + is "$output" "Error: container $dependCid has dependent containers which must be removed before it:.*" "Fail to remove because of dependencies" + run_podman rm --depend $dependCid + is "$output" ".*$cid" "Container should have been removed" + is "$output" ".*$dependCid" "Depend container should have been removed" +} + # I'm sorry! This test takes 13 seconds. There's not much I can do about it, # please know that I think it's justified: podman 1.5.0 had a strange bug # in with exit status was not preserved on some code paths with 'rm -f' diff --git a/test/system/080-pause.bats b/test/system/080-pause.bats index 857c8bbf4..57f390a74 100644 --- a/test/system/080-pause.bats +++ b/test/system/080-pause.bats @@ -21,7 +21,8 @@ load helpers # time to write a new post-restart time value. Pause by CID, unpause # by name, just to exercise code paths. While paused, check 'ps' # and 'inspect', then check again after restarting. - run_podman pause $cid + run_podman --noout pause $cid + is "$output" "" "output should be empty" run_podman inspect --format '{{.State.Status}}' $cid is "$output" "paused" "podman inspect .State.Status" sleep 3 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/170-run-userns.bats b/test/system/170-run-userns.bats index a5be591ef..c020a73ab 100644 --- a/test/system/170-run-userns.bats +++ b/test/system/170-run-userns.bats @@ -78,3 +78,19 @@ EOF # Then check that the main user is not mapped into the user namespace CONTAINERS_CONF=$PODMAN_TMPDIR/userns_auto.conf run_podman 0 run --rm $IMAGE awk '{if($2 == "0"){exit 1}}' /proc/self/uid_map /proc/self/gid_map } + +@test "podman userns=auto and secrets" { + ns_user="containers" + if is_rootless; then + ns_user=$(id -un) + fi + egrep -q "${ns_user}:" /etc/subuid || skip "no IDs allocated for user ${ns_user}" + test_name="test_$(random_string 12)" + secret_file=$PODMAN_TMPDIR/secret$(random_string 12) + secret_content=$(random_string) + echo ${secret_content} > ${secret_file} + run_podman secret create ${test_name} ${secret_file} + run_podman run --rm --secret=${test_name} --userns=auto:size=1000 $IMAGE cat /run/secrets/${test_name} + is ${output} ${secret_content} "Secrets should work with user namespace" + run_podman secret rm ${test_name} +} diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index 57d052ce2..4a3337e57 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -57,13 +57,14 @@ function teardown() { fi # Clean up - run_podman pod rm -f -t 0 $podid + run_podman --noout pod rm -f -t 0 $podid + is "$output" "" "output should be empty" } @test "podman pod create - custom infra image" { + skip_if_remote "CONTAINERS_CONF only effects server side" image="i.do/not/exist:image" - tmpdir=$PODMAN_TMPDIR/pod-test run mkdir -p $tmpdir containersconf=$tmpdir/containers.conf @@ -77,6 +78,9 @@ EOF CONTAINERS_CONF=$containersconf run_podman 125 pod create is "$output" ".*initializing source docker://$image:.*" + + CONTAINERS_CONF=$containersconf run_podman 125 create --pod new:test $IMAGE + is "$output" ".*initializing source docker://$image:.*" } @test "podman pod - communicating between pods" { @@ -327,7 +331,8 @@ EOF # Note that the internal pause image is built even when --infra-image is # set to the K8s one. - run_podman pod create --name $pod_name --infra-name "$infra_name" --infra-image "k8s.gcr.io/pause:3.5" + run_podman --noout pod create --name $pod_name --infra-name "$infra_name" --infra-image "k8s.gcr.io/pause:3.5" + is "$output" "" "output should be empty" run_podman '?' pod create --infra-name "$infra_name" if [ $status -eq 0 ]; then die "Podman should fail when user try to create two pods with the same infra-name value" 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/system/500-networking.bats b/test/system/500-networking.bats index 2b5ad44dc..5a721c965 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -332,7 +332,8 @@ load helpers is_rootless || skip "only meaningful for rootless" local mynetname=testnet-$(random_string 10) - run_podman network create $mynetname + run_podman --noout network create $mynetname + is "$output" "" "output should be empty" # Test that rootless cni adds /usr/sbin to $PATH # iptables is located under /usr/sbin and is needed for the CNI plugins. @@ -340,7 +341,8 @@ load helpers PATH=/usr/local/bin:/usr/bin run_podman run --rm --network $mynetname $IMAGE ip addr is "$output" ".*eth0.*" "Interface eth0 not found in ip addr output" - run_podman network rm -t 0 -f $mynetname + run_podman --noout network rm -t 0 -f $mynetname + is "$output" "" "output should be empty" } @test "podman ipv6 in /etc/resolv.conf" { |