diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-01 19:55:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 19:55:02 +0100 |
commit | b735aa8122cd01a3e7146a7c6f0662b37bbaf377 (patch) | |
tree | 12ec0a157ba7f7e2fd57bf93f577b45ba9737705 /test/system/040-ps.bats | |
parent | 055a7a909103cda8c18b8f24ecd9b919c49074f4 (diff) | |
parent | a17fb01d400f8f3504099fbd65e284124432f274 (diff) | |
download | podman-b735aa8122cd01a3e7146a7c6f0662b37bbaf377.tar.gz podman-b735aa8122cd01a3e7146a7c6f0662b37bbaf377.tar.bz2 podman-b735aa8122cd01a3e7146a7c6f0662b37bbaf377.zip |
Merge pull request #8535 from edsantiago/bats
BATS: add ping test, ps filters, multi-option
Diffstat (limited to 'test/system/040-ps.bats')
-rw-r--r-- | test/system/040-ps.bats | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/system/040-ps.bats b/test/system/040-ps.bats index dec2df4d5..1ed2779b2 100644 --- a/test/system/040-ps.bats +++ b/test/system/040-ps.bats @@ -35,4 +35,51 @@ load helpers run_podman rm $cid } +@test "podman ps --filter" { + run_podman run -d --name runner $IMAGE top + cid_runner=$output + + run_podman run -d --name stopped $IMAGE true + cid_stopped=$output + run_podman wait stopped + + run_podman run -d --name failed $IMAGE false + cid_failed=$output + run_podman wait failed + + run_podman create --name created $IMAGE echo hi + cid_created=$output + + run_podman ps --filter name=runner --format '{{.ID}}' + is "$output" "${cid_runner:0:12}" "filter: name=runner" + + # Stopped container should not appear (because we're not using -a) + run_podman ps --filter name=stopped --format '{{.ID}}' + is "$output" "" "filter: name=stopped (without -a)" + + # Again, but with -a + run_podman ps -a --filter name=stopped --format '{{.ID}}' + is "$output" "${cid_stopped:0:12}" "filter: name=stopped (with -a)" + + run_podman ps --filter status=stopped --format '{{.Names}}' --sort names + is "${lines[0]}" "failed" "status=stopped: 1 of 2" + is "${lines[1]}" "stopped" "status=stopped: 2 of 2" + + run_podman ps --filter status=exited --filter exited=0 --format '{{.Names}}' + is "$output" "stopped" "exited=0" + + run_podman ps --filter status=exited --filter exited=1 --format '{{.Names}}' + is "$output" "failed" "exited=1" + + # Multiple statuses allowed; and test sort=created + run_podman ps -a --filter status=exited --filter status=running \ + --format '{{.Names}}' --sort created + is "${lines[0]}" "runner" "status=stopped: 1 of 3" + is "${lines[1]}" "stopped" "status=stopped: 2 of 3" + is "${lines[2]}" "failed" "status=stopped: 3 of 3" + + run_podman stop -t 1 runner + run_podman rm -a +} + # vim: filetype=sh |