Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1228 from gtardif/healthcheck_e2e
Browse files Browse the repository at this point in the history
Adding e2e test for local compose healthcheck in compose ps
  • Loading branch information
ndeloof authored Feb 3, 2021
2 parents 7d0be7a + bf56815 commit 09f9a11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local/e2e/compose/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`})

Expand Down Expand Up @@ -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")
})
Expand Down
3 changes: 3 additions & 0 deletions local/e2e/compose/fixtures/sentences/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ services:
- "90:80"
labels:
- "my-label=test"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 5s

0 comments on commit 09f9a11

Please sign in to comment.