diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/20-containers.at | 32 | ||||
-rw-r--r-- | test/e2e/config/containers.conf | 2 | ||||
-rw-r--r-- | test/e2e/containers_conf_test.go | 9 | ||||
-rw-r--r-- | test/e2e/create_test.go | 27 | ||||
-rw-r--r-- | test/e2e/run_test.go | 25 |
5 files changed, 95 insertions, 0 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 9efebfeb9..25843e61c 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -98,9 +98,41 @@ t GET libpod/images/newrepo:v2/json 200 \ .Comment=bar \ .Config.Cmd[-1]="/bin/foo" +# Create a container for testing the container initializing later +podman create -t -i --name myctr $IMAGE ls + +# Check configuration before initializing +t GET libpod/containers/myctr/json 200 \ + .Id~[0-9a-f]\\{64\\} \ + .State.Status="configured" \ + .State.Pid=0 \ + .ResolvConfPath="" \ + .HostnamePath="" \ + .HostsPath="" \ + .NetworkSettings.SandboxKey="" + +cpid_file=$(jq -r '.ConmonPidFile' <<<"$output") +userdata_path=$(dirname $cpid_file) + +# Initializing the container +t POST libpod/containers/myctr/init '' 204 + +# Check configuration after initializing +t GET libpod/containers/myctr/json 200 \ + .Id~[0-9a-f]\\{64\\} \ + .State.Status="created" \ + .State.Pid~[0-9]\\{1\,8\\} \ + .ResolvConfPath=$userdata_path/resolv.conf \ + .HostnamePath=$userdata_path/hostname \ + .HostsPath=$userdata_path/hosts \ + .NetworkSettings.SandboxKey~.*/netns/cni- \ + .OCIConfigPath~.*config\.json \ + .GraphDriver.Data.MergedDir~.*merged + t DELETE images/localhost/newrepo:latest?force=true 200 t DELETE images/localhost/newrepo:v1?force=true 200 t DELETE images/localhost/newrepo:v2?force=true 200 t DELETE libpod/containers/$cid 204 +t DELETE libpod/containers/myctr 204 # vim: filetype=sh diff --git a/test/e2e/config/containers.conf b/test/e2e/config/containers.conf index a3bdde786..0a07676c4 100644 --- a/test/e2e/config/containers.conf +++ b/test/e2e/config/containers.conf @@ -48,3 +48,5 @@ default_sysctls = [ dns_searches=[ "foobar.com", ] dns_servers=[ "1.2.3.4", ] dns_options=[ "debug", ] + +tz = "Pacific/Honolulu" diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index 26da9486d..d8e5f2e69 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -211,4 +211,13 @@ var _ = Describe("Podman run", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.LineInOuputStartsWith("search")).To(BeFalse()) }) + + It("podman run containers.conf timezone", func() { + //containers.conf timezone set to Pacific/Honolulu + session := podmanTest.Podman([]string{"run", ALPINE, "date", "+'%H %Z'"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("HST")) + + }) }) diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 5f96f96b1..1e33be013 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -471,4 +471,31 @@ var _ = Describe("Podman create", func() { Expect(len(data)).To(Equal(1)) Expect(data[0].Config.StopSignal).To(Equal(uint(15))) }) + + It("podman create --tz", func() { + session := podmanTest.Podman([]string{"create", "--tz", "foo", "--name", "bad", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"create", "--tz", "America", "--name", "dir", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"create", "--tz", "Pacific/Honolulu", "--name", "zone", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + inspect := podmanTest.Podman([]string{"inspect", "zone"}) + inspect.WaitWithDefaultTimeout() + data := inspect.InspectContainerToJSON() + Expect(len(data)).To(Equal(1)) + Expect(data[0].Config.Timezone).To(Equal("Pacific/Honolulu")) + + session = podmanTest.Podman([]string{"create", "--tz", "local", "--name", "lcl", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + inspect = podmanTest.Podman([]string{"inspect", "lcl"}) + inspect.WaitWithDefaultTimeout() + data = inspect.InspectContainerToJSON() + Expect(len(data)).To(Equal(1)) + Expect(data[0].Config.Timezone).To(Equal("local")) + }) + }) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index e7b68c60f..f49770727 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1047,4 +1047,29 @@ USER mail` Expect(session.ExitCode()).To(Equal(0)) Expect(strings.Contains(session.OutputToString(), groupName)).To(BeTrue()) }) + + It("podman run --tz", func() { + session := podmanTest.Podman([]string{"run", "--tz", "foo", "--rm", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"run", "--tz", "America", "--rm", ALPINE, "date"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"run", "--tz", "Pacific/Honolulu", "--rm", ALPINE, "date", "+'%H %Z'"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("HST")) + + session = podmanTest.Podman([]string{"run", "--tz", "local", "--rm", ALPINE, "date", "+'%H %Z'"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + t := time.Now() + z, _ := t.Zone() + h := strconv.Itoa(t.Hour()) + Expect(session.OutputToString()).To(ContainSubstring(z)) + Expect(session.OutputToString()).To(ContainSubstring(h)) + + }) }) |