summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
Diffstat (limited to 'test/system')
-rw-r--r--test/system/030-run.bats22
-rw-r--r--test/system/035-logs.bats21
-rw-r--r--test/system/090-events.bats11
-rw-r--r--test/system/250-systemd.bats67
-rw-r--r--test/system/500-networking.bats2
-rw-r--r--test/system/700-play.bats2
6 files changed, 121 insertions, 4 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 2c8d08b99..ba21cd21d 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -736,4 +736,26 @@ EOF
is "$output" "$random_1" "output matches STDIN"
}
+@test "podman run defaultenv" {
+ run_podman run --rm $IMAGE printenv
+ is "$output" ".*TERM=xterm" "output matches TERM"
+ is "$output" ".*container=podman" "output matches container=podman"
+
+ run_podman run --unsetenv=TERM --rm $IMAGE printenv
+ is "$output" ".*container=podman" "output matches container=podman"
+ run grep TERM <<<$output
+ is "$output" "" "unwanted TERM environment variable despite --unsetenv=TERM"
+
+ run_podman run --unsetenv-all --rm $IMAGE /bin/printenv
+ run grep TERM <<<$output
+ is "$output" "" "unwanted TERM environment variable despite --unsetenv-all"
+ run grep container <<<$output
+ is "$output" "" "unwanted container environment variable despite --unsetenv-all"
+ run grep PATH <<<$output
+ is "$output" "" "unwanted PATH environment variable despite --unsetenv-all"
+
+ run_podman run --unsetenv-all --env TERM=abc --rm $IMAGE /bin/printenv
+ is "$output" ".*TERM=abc" "missing TERM environment variable despite TERM being set on commandline"
+}
+
# vim: filetype=sh
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index 7fb3e62e4..44984eaad 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -89,6 +89,27 @@ ${cid[0]} d" "Sequential output from logs"
_log_test_multi journald
}
+function _log_test_restarted() {
+ run_podman run --log-driver=$1 --name logtest $IMAGE sh -c 'start=0; if test -s log; then start=`tail -n 1 log`; fi; seq `expr $start + 1` `expr $start + 10` | tee -a log'
+ run_podman start -a logtest
+ logfile=$(mktemp -p ${PODMAN_TMPDIR} logfileXXXXXXXX)
+ $PODMAN $_PODMAN_TEST_OPTS logs -f logtest > $logfile
+ expected=$(mktemp -p ${PODMAN_TMPDIR} expectedXXXXXXXX)
+ seq 1 20 > $expected
+ diff -u ${expected} ${logfile}
+}
+
+@test "podman logs restarted - k8s-file" {
+ _log_test_restarted k8s-file
+}
+
+@test "podman logs restarted journald" {
+ # We can't use journald on RHEL as rootless: rhbz#1895105
+ skip_if_journald_unavailable
+
+ _log_test_restarted journald
+}
+
@test "podman logs - journald log driver requires journald events backend" {
skip_if_remote "remote does not support --events-backend"
# We can't use journald on RHEL as rootless: rhbz#1895105
diff --git a/test/system/090-events.bats b/test/system/090-events.bats
index 1fb542ccd..5af6a3793 100644
--- a/test/system/090-events.bats
+++ b/test/system/090-events.bats
@@ -102,6 +102,17 @@ function _events_disjunctive_filters() {
_events_disjunctive_filters --events-backend=journald
}
+@test "events with file backend and journald logdriver with --follow failure" {
+ skip_if_remote "remote does not support --events-backend"
+ skip_if_journald_unavailable "system does not support journald events"
+ run_podman --events-backend=file run --log-driver=journald --name=test $IMAGE echo hi
+ is "$output" "hi" "Should support events-backend=file"
+
+ run_podman 125 --events-backend=file logs --follow test
+ is "$output" "Error: using --follow with the journald --log-driver but without the journald --events-backend (file) is not supported" "Should fail with reasonable error message when events-backend and events-logger do not match"
+
+}
+
@test "events with disjunctive filters - default" {
_events_disjunctive_filters ""
}
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 98241c309..e997ab6f9 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -9,6 +9,7 @@ load helpers.systemd
SERVICE_NAME="podman_test_$(random_string)"
UNIT_FILE="$UNIT_DIR/$SERVICE_NAME.service"
+TEMPLATE_FILE_PREFIX="$UNIT_DIR/$SERVICE_NAME"
function setup() {
skip_if_remote "systemd tests are meaningless over remote"
@@ -173,10 +174,14 @@ function check_listen_env() {
if is_remote; then
is "$output" "$stdenv" "LISTEN Environment did not pass: $context"
else
- is "$output" "$stdenv
+ out=$(for o in $output; do echo $o; done| sort)
+ std=$(echo "$stdenv
LISTEN_PID=1
LISTEN_FDS=1
-LISTEN_FDNAMES=listen_fdnames" "LISTEN Environment passed: $context"
+LISTEN_FDNAMES=listen_fdnames" | sort)
+ echo "<$out>"
+ echo "<$std>"
+ is "$out" "$std" "LISTEN Environment passed: $context"
fi
}
@@ -201,4 +206,62 @@ LISTEN_FDNAMES=listen_fdnames" "LISTEN Environment passed: $context"
check_listen_env "$stdenv" "podman start"
}
+@test "podman generate - systemd template" {
+ cname=$(random_string)
+ run_podman create --name $cname $IMAGE top
+
+ run_podman generate systemd --template -n $cname
+ echo "$output" > "$TEMPLATE_FILE_PREFIX@.service"
+ run_podman rm -f $cname
+
+ systemctl daemon-reload
+
+ INSTANCE="$SERVICE_NAME@1.service"
+ run systemctl start "$INSTANCE"
+ if [ $status -ne 0 ]; then
+ die "Error starting systemd unit $INSTANCE, output: $output"
+ fi
+
+ run systemctl status "$INSTANCE"
+ if [ $status -ne 0 ]; then
+ die "Non-zero status of systemd unit $INSTANCE, output: $output"
+ fi
+
+ run systemctl stop "$INSTANCE"
+ if [ $status -ne 0 ]; then
+ die "Error stopping systemd unit $INSTANCE, output: $output"
+ fi
+
+ if [[ -z "$status" ]]; then
+ run systemctl is-active "$INSTANCE"
+ if [ $status -ne 0 ]; then
+ die "Error checking stauts of systemd unit $INSTANCE, output: $output"
+ fi
+ is "$output" "$status" "$INSTANCE not in expected state"
+ fi
+
+ rm -f "$TEMPLATE_FILE_PREFIX@.service"
+ systemctl daemon-reload
+}
+
+@test "podman generate - systemd template no support for pod" {
+ cname=$(random_string)
+ podname=$(random_string)
+ run_podman pod create --name $podname
+ run_podman run --pod $podname -dt --name $cname $IMAGE top
+
+ run_podman 125 generate systemd --new --template -n $podname
+ is "$output" ".*--template is not supported for pods.*" "Error message contains 'not supported'"
+
+ run_podman rm -f $cname
+ run_podman pod rm -f $podname
+}
+
+@test "podman generate - systemd template only used on --new" {
+ cname=$(random_string)
+ run_podman create --name $cname $IMAGE top
+ run_podman 125 generate systemd --new=false --template -n $cname
+ is "$output" ".*--template cannot be set" "Error message should be '--template requires --new'"
+}
+
# vim: filetype=sh
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 21350ed36..deadfa90a 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -172,7 +172,7 @@ load helpers
# FIXME: debugging for #11871
run_podman exec $cid cat /etc/resolv.conf
- if is_rootless; then
+ if is_rootless && ! is_remote; then
run_podman unshare --rootless-cni cat /etc/resolv.conf
fi
ps uxww
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index c3e5e9354..b77d41920 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -11,7 +11,7 @@ function teardown() {
run_podman rm -t 0 -f -a
run_podman image list --format '{{.ID}} {{.Repository}}'
while read id name; do
- if [[ "$name" =~ /pause ]]; then
+ if [[ "$name" =~ /podman-pause ]]; then
run_podman rmi $id
fi
done <<<"$output"