Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system test: Add --log-driver test for podman run #7467

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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