Skip to content

Commit

Permalink
system test: Add --log-driver test for podman run
Browse files Browse the repository at this point in the history
Add a test for testing options for podman run --log-driver.

Signed-off-by: Yiqiao Pu <[email protected]>
  • Loading branch information
ypu committed Aug 27, 2020
1 parent f99954c commit 93e9fb3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,28 @@ echo $rand | 0 | $rand
run_podman wait $cid
}

@test "podman run --log-driver" {
randomlog=$(random_string 30)

run_podman run --log-driver k8s-file --log-opt path=$PODMAN_TMPDIR/podmantest.log --rm $IMAGE echo $randomlog
run grep $randomlog $PODMAN_TMPDIR/podmantest.log
is "$output" ".*stdout.*$randomlog" "log should exist in log file"

run_podman run --log-driver journald --name test-journald $IMAGE echo $randomlog
run grep $randomlog <(journalctl)
is "$output" ".*$randomlog" "log should exist in journalctl output"
run_podman logs test-journald
is "$output" ".*$randomlog" "logs can be read from journald"

run_podman run --log-driver none --name test-none $IMAGE sleep 1
run_podman 125 logs test-none
is "$output" ".*this container is not logging output" "can not read log when set --log-driver to none"

run_podman run --log-driver json-file --log-opt path=$PODMAN_TMPDIR/json-file.log --name test-jsonfile $IMAGE echo $randomlog
run grep $randomlog $PODMAN_TMPDIR/json-file.log
is "$output" ".*stdout.*$randomlog" "json-file aliased to k8s-file for scripting compatibility."
run_podman logs test-jsonfile
is "$output" ".*stdout.*$randomlog" "logs can be read from log file"
}

# vim: filetype=sh

0 comments on commit 93e9fb3

Please sign in to comment.