summaryrefslogtreecommitdiff
path: root/test/system/030-run.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-30 00:24:55 +0000
committerGitHub <noreply@github.com>2020-09-30 00:24:55 +0000
commitb68b6f334d4a83de35d68cc359365b348e72ad6b (patch)
treed78aad8deff9f2d05a4af3b2f3c3e272c7f9a37d /test/system/030-run.bats
parent453333a35cc791e9031e5d24e0ac5e76a2b2aa75 (diff)
parent258ccfc3c9f896393161e66c86ad2b11a9a22927 (diff)
downloadpodman-b68b6f334d4a83de35d68cc359365b348e72ad6b.tar.gz
podman-b68b6f334d4a83de35d68cc359365b348e72ad6b.tar.bz2
podman-b68b6f334d4a83de35d68cc359365b348e72ad6b.zip
Merge pull request #7832 from edsantiago/bats_run_tz
System tests: add podman run --tz
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r--test/system/030-run.bats24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 813dd9266..eb740f04b 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -408,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