summaryrefslogtreecommitdiff
path: root/test/system/040-ps.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-11-19 09:57:06 -0700
committerEd Santiago <santiago@redhat.com>2020-12-01 08:14:54 -0700
commita17fb01d400f8f3504099fbd65e284124432f274 (patch)
tree26619409c5f94c0f93cca9e54eaf833bb7dd1b5b /test/system/040-ps.bats
parent24383906f891cea0c802f911deed43f8f8f2ac85 (diff)
downloadpodman-a17fb01d400f8f3504099fbd65e284124432f274.tar.gz
podman-a17fb01d400f8f3504099fbd65e284124432f274.tar.bz2
podman-a17fb01d400f8f3504099fbd65e284124432f274.zip
BATS: add ping test
- run test : tweaks to recently-added network-conflict test: * remove "-d" in run * confirm exact warning text, and also that container runs successfully * test multiple --net options (regression #8057) - images, run, build, exec tests: add multiple-flag testing for various flags, confirming as appropriate whether options are overridden or accumulated. - ps test : add --filter and --sort tests - pod test: run 'ping' inside container (confirms that container gets PING capability) Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/040-ps.bats')
-rw-r--r--test/system/040-ps.bats47
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