Skip to content

Commit

Permalink
CI: e2e: first use of new ExitCleanly() matcher
Browse files Browse the repository at this point in the history
A nearly-trivial first effort to use the new ExitCleanly().
Requires using the new CITEST_IMAGE (see prior commit)
because nginx causes the tests to fail:

   [FAILED] Unexpected warnings seen on stderr: \
            level=warning \
            msg="HEALTHCHECK is not supported for OCI image format ...

Oh, I also took the liberty of rewriting "play kube" -> "kube play".

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Aug 29, 2023
1 parent aa28c50 commit 233ca95
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions test/e2e/play_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
. "github.com/containers/podman/v4/test/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)

var _ = Describe("Podman play kube with build", func() {
Expand Down Expand Up @@ -51,12 +50,12 @@ status: {}
`

var playBuildFile = `
FROM quay.io/libpod/alpine_nginx:latest
FROM ` + CITEST_IMAGE + `
LABEL homer=dad
COPY copyfile /copyfile
`
var prebuiltImage = `
FROM quay.io/libpod/alpine_nginx:latest
FROM ` + CITEST_IMAGE + `
LABEL marge=mom
`

Expand Down Expand Up @@ -84,17 +83,17 @@ LABEL marge=mom
Expect(os.Chdir(yamlDir)).To(Succeed())
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()

session := podmanTest.Podman([]string{"play", "kube", "top.yaml"})
session := podmanTest.Podman([]string{"kube", "play", "top.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

exists := podmanTest.Podman([]string{"image", "exists", "foobar"})
exists.WaitWithDefaultTimeout()
Expect(exists).Should(Exit(0))
Expect(exists).Should(ExitCleanly())

inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
Expand All @@ -121,17 +120,17 @@ LABEL marge=mom
Expect(os.Chdir(yamlDir)).To(Succeed())
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()

session := podmanTest.Podman([]string{"play", "kube", "top.yaml"})
session := podmanTest.Podman([]string{"kube", "play", "top.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

exists := podmanTest.Podman([]string{"image", "exists", "foobar"})
exists.WaitWithDefaultTimeout()
Expect(exists).Should(Exit(0))
Expect(exists).Should(ExitCleanly())

inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
Expand Down Expand Up @@ -169,15 +168,15 @@ LABEL marge=mom
// Build the image into the local store
build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"})
build.WaitWithDefaultTimeout()
Expect(build).Should(Exit(0))
Expect(build).Should(ExitCleanly())

session := podmanTest.Podman([]string{"play", "kube", "top.yaml"})
session := podmanTest.Podman([]string{"kube", "play", "top.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())
Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
Expand Down Expand Up @@ -216,15 +215,15 @@ LABEL marge=mom
// Build the image into the local store
build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"})
build.WaitWithDefaultTimeout()
Expect(build).Should(Exit(0))
Expect(build).Should(ExitCleanly())

session := podmanTest.Podman([]string{"play", "kube", "--build=false", "top.yaml"})
session := podmanTest.Podman([]string{"kube", "play", "--build=false", "top.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())
Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
Expand Down Expand Up @@ -263,15 +262,15 @@ LABEL marge=mom
// Build the image into the local store
build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"})
build.WaitWithDefaultTimeout()
Expect(build).Should(Exit(0))
Expect(build).Should(ExitCleanly())

session := podmanTest.Podman([]string{"play", "kube", "--build", "top.yaml"})
session := podmanTest.Podman([]string{"kube", "play", "--build", "top.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
Expand Down Expand Up @@ -352,21 +351,21 @@ echo GOT-HERE

session := podmanTest.Podman([]string{"kube", "play", "echo.yaml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())

cid := "echo_pod-foobar"
wait := podmanTest.Podman([]string{"wait", cid})
wait.WaitWithDefaultTimeout()
Expect(wait).To(Exit(0))
Expect(wait).To(ExitCleanly())

logs := podmanTest.Podman([]string{"logs", cid})
logs.WaitWithDefaultTimeout()
Expect(logs).Should(Exit(0))
Expect(logs).Should(ExitCleanly())
Expect(logs.OutputToString()).To(Equal("parenBAR braceBAR dollardollarparenGOT-HERE interpBARolate"))

inspect := podmanTest.Podman([]string{"container", "inspect", cid})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
inspectData := inspect.InspectContainerToJSON()
Expect(inspectData).ToNot(BeEmpty())

Expand Down

0 comments on commit 233ca95

Please sign in to comment.