summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
Diffstat (limited to 'test/system')
-rw-r--r--test/system/030-run.bats45
-rw-r--r--test/system/075-exec.bats4
-rw-r--r--test/system/500-networking.bats2
-rwxr-xr-xtest/system/build-testimage7
-rw-r--r--test/system/helpers.bash2
5 files changed, 53 insertions, 7 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index b3599cc17..766948ecc 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -153,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
@@ -304,7 +319,7 @@ echo $rand | 0 | $rand
# #6991 : /etc/passwd is modifiable
@test "podman run : --userns=keep-id: passwd file is modifiable" {
- 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
@@ -325,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
}
@@ -393,4 +408,28 @@ json-file | f
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
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
index e9db8c27e..edd7dedc4 100644
--- a/test/system/075-exec.bats
+++ b/test/system/075-exec.bats
@@ -92,14 +92,14 @@ load helpers
# #6829 : add username to /etc/passwd inside container if --userns=keep-id
@test "podman exec - with keep-id" {
run_podman run -d --userns=keep-id $IMAGE sh -c \
- "echo READY;while [ ! -f /stop ]; do sleep 1; done"
+ "echo READY;while [ ! -f /tmp/stop ]; do sleep 1; done"
cid="$output"
wait_for_ready $cid
run_podman exec $cid id -un
is "$output" "$(id -un)" "container is running as current user"
- run_podman exec --user=$(id -un) $cid touch /stop
+ run_podman exec --user=$(id -un) $cid touch /tmp/stop
run_podman wait $cid
run_podman rm $cid
}
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index d2454fbf4..150626ded 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -99,7 +99,7 @@ load helpers
"Trying to create an already-existing network"
run_podman network rm $mynetname
- run_podman 125 network rm $mynetname
+ run_podman 1 network rm $mynetname
# rootless CNI leaves behind an image pulled by SHA, hence with no tag.
# Remove it if present; we can only remove it by ID.
diff --git a/test/system/build-testimage b/test/system/build-testimage
index ef14d3afd..53ade57f0 100755
--- a/test/system/build-testimage
+++ b/test/system/build-testimage
@@ -35,6 +35,12 @@ cd $tmpdir
# 'image mount' test will confirm that this file exists and has our YMD tag
echo $YMD >testimage-id
+# ...but set the timestamp on the file itself to a constant well-known
+# value, for use by the 'run --tz' test. Date value chosen for nerdiness
+# and because it's in the past. (Much as I'd love FFFFFFFF, we can't
+# use any future date because of unpredictable leap second adjustments).
+touch --date=@1600000000 testimage-id
+
# 'pod' test will use this for --infra-command
cat >pause <<EOF
#!/bin/sh
@@ -49,6 +55,7 @@ EOF
chmod 755 pause
# alpine because it's small and light and reliable
+# - check for updates @ https://hub.docker.com/_/alpine
# busybox-extras provides httpd needed in 500-networking.bats
cat >Containerfile <<EOF
FROM docker.io/library/alpine:3.12.0
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index eb3e4c7ec..998db5283 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -7,7 +7,7 @@ PODMAN=${PODMAN:-podman}
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
-PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20200917"}
+PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20200929"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
# Because who wants to spell that out each time?