diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-06 23:36:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 23:36:09 +0100 |
commit | 3ac1219cbcfe8ccd83ed7b73b92e1d6f13abf550 (patch) | |
tree | 4fe890289a727982ddf77569ac1d1db45a8068c8 /test | |
parent | d62752819214ee7f910e25d368d427fbcac74b17 (diff) | |
parent | 2a524fcaec4e6f66461d7cdda1bb73ed7c50f026 (diff) | |
download | podman-3ac1219cbcfe8ccd83ed7b73b92e1d6f13abf550.tar.gz podman-3ac1219cbcfe8ccd83ed7b73b92e1d6f13abf550.tar.bz2 podman-3ac1219cbcfe8ccd83ed7b73b92e1d6f13abf550.zip |
Merge pull request #12614 from baude/bz2028408
fix healthcheck timeouts and ut8 coercion
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/healthcheck_run_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index c2084a6fd..6a79006b6 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -2,7 +2,9 @@ package integration import ( "fmt" + "io/ioutil" "os" + "path/filepath" "time" define "github.com/containers/podman/v3/libpod/define" @@ -258,4 +260,40 @@ var _ = Describe("Podman healthcheck run", func() { Expect(startAgain.OutputToString()).To(Equal("hc")) Expect(startAgain.ErrorToString()).To(Equal("")) }) + + It("Verify default time is used and no utf-8 escapes", func() { + cwd, err := os.Getwd() + Expect(err).To(BeNil()) + + podmanTest.AddImageToRWStore(ALPINE) + // Write target and fake files + targetPath, err := CreateTempDirInTempDir() + Expect(err).To(BeNil()) + containerfile := fmt.Sprintf(`FROM %s +HEALTHCHECK CMD ls -l / 2>&1`, ALPINE) + containerfilePath := filepath.Join(targetPath, "Containerfile") + err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644) + Expect(err).To(BeNil()) + defer func() { + Expect(os.Chdir(cwd)).To(BeNil()) + Expect(os.RemoveAll(targetPath)).To(BeNil()) + }() + + // make cwd as context root path + Expect(os.Chdir(targetPath)).To(BeNil()) + + session := podmanTest.Podman([]string{"build", "--format", "docker", "-t", "test", "."}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + run := podmanTest.Podman([]string{"run", "-dt", "--name", "hctest", "test", "ls"}) + run.WaitWithDefaultTimeout() + Expect(run).Should(Exit(0)) + + inspect := podmanTest.InspectContainer("hctest") + // Check to make sure a default time value was added + Expect(inspect[0].Config.Healthcheck.Timeout).To(BeNumerically("==", 30000000000)) + // Check to make sure characters were not coerced to utf8 + Expect(inspect[0].Config.Healthcheck.Test).To(Equal([]string{"CMD-SHELL", "ls -l / 2>&1"})) + }) }) |