diff options
author | Ed Santiago <santiago@redhat.com> | 2019-12-23 05:43:08 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-01-13 06:29:52 -0700 |
commit | 1298f19773574963b9ce5ba7ca3b1637d1a07ef6 (patch) | |
tree | 69367bb8637056113e793d812c70af9c4f5a62d9 /test/system/030-run.bats | |
parent | 9e2e4d7615311b38b1e553af32a5666888ef3c96 (diff) | |
download | podman-1298f19773574963b9ce5ba7ca3b1637d1a07ef6.tar.gz podman-1298f19773574963b9ce5ba7ca3b1637d1a07ef6.tar.bz2 podman-1298f19773574963b9ce5ba7ca3b1637d1a07ef6.zip |
more BATS tests
- run: --name (includes 'podman container exists' tests)
- run: --pull (always, never, missing)
- build: new test for ADD URL (#4420)
- exec: new test for issue #4785 (pipe getting lost)
- diff: new test
- selinux (mostly copied from docker-autotest)
Plus a bug fix: the wait_for_output() helper would continue
checking, eventually timing out, even if the container had
already exited (probably because of an error). Fix: as
part of the loop, run 'podman inspect' and bail out if
container is not running. Include exit code and logs.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r-- | test/system/030-run.bats | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 7cbb60501..f1e9776c1 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -85,4 +85,55 @@ echo $rand | 0 | $rand run_podman 1 run --rm $IMAGE sh -c /bin/false } +@test "podman run --name" { + randomname=$(random_string 30) + + # Assume that 4 seconds gives us enough time for 3 quick tests (or at + # least for the 'ps'; the 'container exists' should pass even in the + # unlikely case that the container exits before we get to them) + run_podman run -d --name $randomname $IMAGE sleep 4 + cid=$output + + run_podman ps --format '{{.Names}}--{{.ID}}' + is "$output" "$randomname--${cid:0:12}" + + run_podman container exists $randomname + run_podman container exists $cid + + # Done with live-container tests; now let's test after container finishes + run_podman wait $cid + + # Container still exists even after stopping: + run_podman container exists $randomname + run_podman container exists $cid + + # ...but not after being removed: + run_podman rm $cid + run_podman 1 container exists $randomname + run_podman 1 container exists $cid +} + +@test "podman run --pull" { + skip_if_remote "podman-remote does not emit 'Trying to pull' msgs" + + run_podman run --pull=missing $IMAGE true + is "$output" "" "--pull=missing [present]: no output" + + run_podman run --pull=never $IMAGE true + is "$output" "" "--pull=never [present]: no output" + + # Now test with busybox, which we don't have present + run_podman 125 run --pull=never busybox true + is "$output" "Error: unable to find a name and tag match for busybox in repotags: no such image" "--pull=never [busybox/missing]: error" + + run_podman run --pull=missing busybox true + is "$output" "Trying to pull .*" "--pull=missing [busybox/missing]: fetches" + + run_podman run --pull=always busybox true + is "$output" "Trying to pull .*" "--pull=always [busybox/present]: fetches" + + run_podman rm -a + run_podman rmi busybox +} + # vim: filetype=sh |