summaryrefslogtreecommitdiff
path: root/test/system/030-run.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r--test/system/030-run.bats68
1 files changed, 56 insertions, 12 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 11edaf11c..766948ecc 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -14,7 +14,7 @@ load helpers
# ...but check the configured runtime engine, and switch to crun as needed
run_podman info --format '{{ .Host.OCIRuntime.Path }}'
if expr "$output" : ".*/crun"; then
- err_no_such_cmd="Error: executable file not found in \$PATH: No such file or directory: OCI runtime command not found error"
+ err_no_such_cmd="Error: executable file.* not found in \$PATH: No such file or directory: OCI runtime command not found error"
err_no_exec_dir="Error: open executable: Operation not permitted: OCI runtime permission denied error"
fi
@@ -132,8 +132,6 @@ echo $rand | 0 | $rand
}
@test "podman run --pull" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
-
run_podman run --pull=missing $IMAGE true
is "$output" "" "--pull=missing [present]: no output"
@@ -155,8 +153,23 @@ echo $rand | 0 | $rand
run_podman run --pull=always $NONLOCAL_IMAGE true
is "$output" "Trying to pull .*" "--pull=always [with image PRESENT]: re-fetches"
+ # Very weird corner case fixed by #7770: 'podman run foo' will run 'myfoo'
+ # if it exists, because the string 'foo' appears in 'myfoo'. This test
+ # covers that, as well as making sure that our testimage (which is always
+ # tagged :YYYYMMDD, never :latest) doesn't match either.
+ run_podman tag $IMAGE my${PODMAN_TEST_IMAGE_NAME}:latest
+ run_podman 125 run --pull=never $PODMAN_TEST_IMAGE_NAME true
+ is "$output" "Error: unable to find a name and tag match for $PODMAN_TEST_IMAGE_NAME in repotags: no such image" \
+ "podman run --pull=never with shortname (and implicit :latest)"
+
+ # ...but if we add a :latest tag (without 'my'), it should now work
+ run_podman tag $IMAGE ${PODMAN_TEST_IMAGE_NAME}:latest
+ run_podman run --pull=never ${PODMAN_TEST_IMAGE_NAME} cat /home/podman/testimage-id
+ is "$output" "$PODMAN_TEST_IMAGE_TAG" \
+ "podman run --pull=never, with shortname, succeeds if img is present"
+
run_podman rm -a
- run_podman rmi $NONLOCAL_IMAGE
+ run_podman rmi $NONLOCAL_IMAGE {my,}${PODMAN_TEST_IMAGE_NAME}:latest
}
# 'run --rmi' deletes the image in the end unless it's used by another container
@@ -267,8 +280,6 @@ echo $rand | 0 | $rand
# symptom only manifests on a fedora container image -- we have no
# reproducer on alpine. Checking directory ownership is good enough.
@test "podman run : user namespace preserved root ownership" {
- skip_if_remote "FIXME: pending #7195"
-
for priv in "" "--privileged"; do
for user in "--user=0" "--user=100"; do
for keepid in "" "--userns=keep-id"; do
@@ -286,8 +297,6 @@ echo $rand | 0 | $rand
# #6829 : add username to /etc/passwd inside container if --userns=keep-id
@test "podman run : add username to /etc/passwd if --userns=keep-id" {
- skip_if_remote "FIXME: pending #7195"
-
# Default: always run as root
run_podman run --rm $IMAGE id -un
is "$output" "root" "id -un on regular container"
@@ -310,9 +319,7 @@ echo $rand | 0 | $rand
# #6991 : /etc/passwd is modifiable
@test "podman run : --userns=keep-id: passwd file is modifiable" {
- skip_if_remote "FIXME: pending #7195"
-
- run_podman run -d --userns=keep-id $IMAGE sh -c 'while ! test -e /stop; do sleep 0.1; done'
+ run_podman run -d --userns=keep-id --cap-add=dac_override $IMAGE sh -c 'while ! test -e /tmp/stop; do sleep 0.1; done'
cid="$output"
# Assign a UID that is (a) not in our image /etc/passwd and (b) not
@@ -333,7 +340,7 @@ echo $rand | 0 | $rand
is "$output" "newuser3:x:$uid:999:$gecos:/home/newuser3:/bin/sh" \
"newuser3 added to /etc/passwd in container"
- run_podman exec $cid touch /stop
+ run_podman exec $cid touch /tmp/stop
run_podman wait $cid
}
@@ -387,5 +394,42 @@ json-file | f
"--log-driver InvalidDriver"
}
+@test "podman run --log-driver journald" {
+ skip_if_remote "We cannot read journalctl over remote."
+
+ msg=$(random_string 20)
+ pidfile="${PODMAN_TMPDIR}/$(random_string 20)"
+
+ run_podman run --name myctr --log-driver journald --conmon-pidfile $pidfile $IMAGE echo $msg
+
+ journalctl --output cat _PID=$(cat $pidfile)
+ is "$output" "$msg" "check that journalctl output equals the container output"
+
+ run_podman rm myctr
+}
+
+@test "podman run --tz" {
+ # This file will always have a constant reference timestamp
+ local testfile=/home/podman/testimage-id
+
+ run_podman run --rm $IMAGE date -r $testfile
+ is "$output" "Sun Sep 13 12:26:40 UTC 2020" "podman run with no TZ"
+
+ run_podman run --rm --tz=MST7MDT $IMAGE date -r $testfile
+ is "$output" "Sun Sep 13 06:26:40 MDT 2020" "podman run with --tz=MST7MDT"
+
+ # --tz=local pays attention to /etc/localtime, not $TZ. We set TZ anyway,
+ # to make sure podman ignores it; and, because this test is locale-
+ # dependent, we pick an obscure zone (+1245) that is unlikely to
+ # collide with any of our testing environments.
+ #
+ # To get a reference timestamp we run 'date' locally; note the explicit
+ # strftime() format. We can't use --iso=seconds because GNU date adds
+ # a colon to the TZ offset (eg -07:00) whereas alpine does not (-0700).
+ run date --date=@1600000000 +%Y-%m-%dT%H:%M:%S%z
+ expect="$output"
+ TZ=Pacific/Chatham run_podman run --rm --tz=local $IMAGE date -Iseconds -r $testfile
+ is "$output" "$expect" "podman run with --tz=local, matches host"
+}
# vim: filetype=sh