Adding e2e test for local compose healthcheck in compose ps

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-02-03 12:54:22 +01:00
parent 7d0be7ad5a
commit bf56815251
2 changed files with 10 additions and 1 deletions

View File

@ -53,7 +53,7 @@ func TestLocalComposeUp(t *testing.T) {
c.RunDockerCmd("compose", "-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
})
t.Run("check running project", func(t *testing.T) {
t.Run("check accessing running app", func(t *testing.T) {
res := c.RunDockerCmd("compose", "-p", projectName, "ps")
res.Assert(t, icmd.Expected{Out: `web`})
@ -89,6 +89,12 @@ func TestLocalComposeUp(t *testing.T) {
})
t.Run("check healthcheck display", func(t *testing.T) {
c.WaitForCmdResult(c.NewDockerCmd("compose", "-p", projectName, "ps", "--format", "json"),
StdoutContains(`"Name":"compose-e2e-demo_web_1","Project":"compose-e2e-demo","Service":"web","State":"running","Health":"healthy"`),
5*time.Second, 1*time.Second)
})
t.Run("down", func(t *testing.T) {
_ = c.RunDockerCmd("compose", "--project-name", projectName, "down")
})

View File

@ -11,3 +11,6 @@ services:
- "90:80"
labels:
- "my-label=test"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 5s