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

Commit 09f9a11

Browse files
authored
Merge pull request #1228 from gtardif/healthcheck_e2e
Adding e2e test for local compose healthcheck in compose ps
2 parents 7d0be7a + bf56815 commit 09f9a11

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

local/e2e/compose/compose_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestLocalComposeUp(t *testing.T) {
5353
c.RunDockerCmd("compose", "-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
5454
})
5555

56-
t.Run("check running project", func(t *testing.T) {
56+
t.Run("check accessing running app", func(t *testing.T) {
5757
res := c.RunDockerCmd("compose", "-p", projectName, "ps")
5858
res.Assert(t, icmd.Expected{Out: `web`})
5959

@@ -89,6 +89,12 @@ func TestLocalComposeUp(t *testing.T) {
8989

9090
})
9191

92+
t.Run("check healthcheck display", func(t *testing.T) {
93+
c.WaitForCmdResult(c.NewDockerCmd("compose", "-p", projectName, "ps", "--format", "json"),
94+
StdoutContains(`"Name":"compose-e2e-demo_web_1","Project":"compose-e2e-demo","Service":"web","State":"running","Health":"healthy"`),
95+
5*time.Second, 1*time.Second)
96+
})
97+
9298
t.Run("down", func(t *testing.T) {
9399
_ = c.RunDockerCmd("compose", "--project-name", projectName, "down")
94100
})

local/e2e/compose/fixtures/sentences/compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ services:
1111
- "90:80"
1212
labels:
1313
- "my-label=test"
14+
healthcheck:
15+
test: ["CMD", "curl", "-f", "http://localhost:80/"]
16+
interval: 5s

0 commit comments

Comments
 (0)