summaryrefslogtreecommitdiff
path: root/test/system/035-logs.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-19 09:12:27 -0700
committerGitHub <noreply@github.com>2019-03-19 09:12:27 -0700
commit537c382f5bd098bc89a457554db9bd0b08eab3c2 (patch)
tree649331a8c1b88393f07fe061390e5ca8a51b2007 /test/system/035-logs.bats
parenta1299f506d9b93824fae737f0f68a19adaf2bde1 (diff)
parent58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (diff)
downloadpodman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.gz
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.bz2
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.zip
Merge pull request #2703 from edsantiago/bats
BATS: new tests, and improvements to existing ones
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