summaryrefslogtreecommitdiff
path: root/test/system/035-logs.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-07 15:15:50 -0700
committerEd Santiago <santiago@redhat.com>2019-03-18 15:21:52 -0600
commit58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (patch)
tree647f839b8dda979e8526f6aa335d4bc2c52ff468 /test/system/035-logs.bats
parent07e10d9dd6c0c0828637f770234266daa182fc95 (diff)
downloadpodman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.gz
podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.bz2
podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.zip
BATS: new tests, and improvements to existing ones
New: - podman exec - podman load (requires #2674) - CLI parsing (regression test for #2574) Improved: - help: test "podman NoSuchCommand", and subcommands - help: test "podman cmd" without required args - pod: start with --infra=false; this allows running rootless - log: also run 'logs' after container is run - log: test -f with two containers Also, use helpful descriptions for skip_if_rootless Tested on f29, root and rootless. As soon as podman-remote supports rm, I'll start testing that too. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/035-logs.bats')
-rw-r--r--test/system/035-logs.bats27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index debec29b6..055865c8d 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -18,7 +18,34 @@ load helpers
is "$output" "$rand_string" "output from podman-start on created ctr"
is "$output" "$rand_string" "logs of started container"
+ run_podman logs $cid
+ is "$output" "$rand_string" "output from podman-logs after container is run"
+
run_podman rm $cid
}
+@test "podman logs - multi" {
+ # Simple helper to make the container starts, below, easier to read
+ local -a cid
+ doit() {
+ run_podman run --rm -d --name "$1" $IMAGE sh -c "$2";
+ cid+=($(echo "${output:0:12}"))
+ }
+
+ # Not really a guarantee that we'll get a-b-c-d in order, but it's
+ # the best we can do. The trailing 'sleep' in each container
+ # minimizes the chance of a race condition in which the container
+ # is removed before 'podman logs' has a chance to wake up and read
+ # the final output.
+ doit c1 "echo a;sleep 10;echo d;sleep 3"
+ doit c2 "sleep 1;echo b;sleep 2;echo c;sleep 3"
+
+ run_podman logs -f c1 c2
+ is "$output" \
+ "${cid[0]} a
+${cid[1]} b
+${cid[1]} c
+${cid[0]} d" "Sequential output from logs"
+}
+
# vim: filetype=sh