mirror of https://github.com/docker/compose.git
Merge pull request #1228 from gtardif/healthcheck_e2e
Adding e2e test for local compose healthcheck in compose ps
This commit is contained in:
commit
09f9a117e2
|
@ -53,7 +53,7 @@ func TestLocalComposeUp(t *testing.T) {
|
||||||
c.RunDockerCmd("compose", "-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
|
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 := c.RunDockerCmd("compose", "-p", projectName, "ps")
|
||||||
res.Assert(t, icmd.Expected{Out: `web`})
|
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) {
|
t.Run("down", func(t *testing.T) {
|
||||||
_ = c.RunDockerCmd("compose", "--project-name", projectName, "down")
|
_ = c.RunDockerCmd("compose", "--project-name", projectName, "down")
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,3 +11,6 @@ services:
|
||||||
- "90:80"
|
- "90:80"
|
||||||
labels:
|
labels:
|
||||||
- "my-label=test"
|
- "my-label=test"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:80/"]
|
||||||
|
interval: 5s
|
||||||
|
|
Loading…
Reference in New Issue