summaryrefslogtreecommitdiff
path: root/test/system/001-basic.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/001-basic.bats')
-rw-r--r--test/system/001-basic.bats64
1 files changed, 62 insertions, 2 deletions
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index e3302bec3..378edc013 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -188,17 +188,77 @@ See 'podman version --help'" "podman version --remote"
@test "podman --log-level recognizes log levels" {
run_podman 1 --log-level=telepathic info
is "$output" 'Log Level "telepathic" is not supported.*'
+
run_podman --log-level=trace info
+ if ! is_remote; then
+ # podman-remote does not do any trace logging
+ assert "$output" =~ " level=trace " "log-level=trace"
+ fi
+ assert "$output" =~ " level=debug " "log-level=trace includes debug"
+ assert "$output" =~ " level=info " "log-level=trace includes info"
+ assert "$output" !~ " level=warn" "log-level=trace does not show warn"
+
run_podman --log-level=debug info
+ assert "$output" !~ " level=trace " "log-level=debug does not show trace"
+ assert "$output" =~ " level=debug " "log-level=debug"
+ assert "$output" =~ " level=info " "log-level=debug includes info"
+ assert "$output" !~ " level=warn" "log-level=debug does not show warn"
+
run_podman --log-level=info info
+ assert "$output" !~ " level=trace " "log-level=info does not show trace"
+ assert "$output" !~ " level=debug " "log-level=info does not show debug"
+ assert "$output" =~ " level=info " "log-level=info"
+
run_podman --log-level=warn info
+ assert "$output" !~ " level=" "log-level=warn shows no logs at all"
+
+ # Force a warning (local podman only; podman-remote doesn't check versions)
+ if ! is_remote; then
+ run_podman --log-level=warn --storage-opt=mount_program=/bin/false info
+ assert "$output" =~ " level=warning msg=\"Failed to retrieve " \
+ "log-level=warn"
+
+ # confirm that default level is "warn", by invoking without --log-level
+ run_podman --storage-opt=mount_program=/bin/false info
+ assert "$output" =~ " level=warning msg=\"Failed to retrieve " \
+ "default log level includes warning messages"
+ fi
+
run_podman --log-level=warning info
+ assert "$output" !~ " level=" "log-level=warning shows no logs at all"
+
run_podman --log-level=error info
- run_podman --log-level=fatal info
- run_podman --log-level=panic info
+ assert "$output" !~ " level=" "log-level=error shows no logs at all"
+
+ # error, fatal, panic:
+ if is_remote; then
+ # podman-remote does not grok --runtime; all we can do is test parsing
+ for level in error fatal panic; do
+ run_podman --log-level=$level info
+ assert "$output" !~ " level=" \
+ "log-level=$level shows no logs at all"
+ done
+ else
+ # local podman only
+ run_podman --log-level=error --storage-opt=mount_program=/bin/false --runtime=/bin/false info
+ assert "$output" =~ " level=error msg=\"Getting info on OCI runtime " \
+ "log-level=error shows "
+ assert "$output" !~ " level=warn" \
+ "log-level=error does not show warnings"
+
+ run_podman --log-level=fatal --storage-opt=mount_program=/bin/false --runtime=/bin/false info
+ assert "$output" !~ " level=" "log-level=fatal shows no logs at all"
+
+ run_podman --log-level=panic --storage-opt=mount_program=/bin/false --runtime=/bin/false info
+ assert "$output" !~ " level=" "log-level=panic shows no logs at all"
+ fi
+
# docker compat
run_podman --debug info
+ assert "$output" =~ " level=debug " "podman --debug gives debug output"
run_podman -D info
+ assert "$output" =~ " level=debug " "podman -D gives debug output"
+
run_podman 1 --debug --log-level=panic info
is "$output" "Setting --log-level and --debug is not allowed"
}