Skip to content

Commit eececb9

Browse files
jhrotkoglours
authored andcommitted
Add profile e2e test case to document in compose
Signed-off-by: Joana Hrotko <[email protected]>
1 parent 501b5ac commit eececb9

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
foo:
3+
container_name: foo_c
4+
profiles: [ test ]
5+
image: alpine
6+
depends_on: [ db ]
7+
8+
bar:
9+
container_name: bar_c
10+
profiles: [ test ]
11+
image: alpine
12+
13+
db:
14+
container_name: db_c
15+
image: alpine

pkg/e2e/up_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,16 @@ func TestUpWithAllResources(t *testing.T) {
179179
assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol" Created`, projectName)), res.Combined())
180180
assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net Created`, projectName)), res.Combined())
181181
}
182+
183+
func TestUpProfile(t *testing.T) {
184+
c := NewCLI(t)
185+
const projectName = "compose-e2e-up-profile"
186+
t.Cleanup(func() {
187+
c.RunDockerComposeCmd(t, "--project-name", projectName, "--profile", "test", "down", "-v")
188+
})
189+
190+
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/profiles/docker-compose.yaml", "--project-name", projectName, "up", "foo")
191+
assert.Assert(t, strings.Contains(res.Combined(), `Container db_c Created`), res.Combined())
192+
assert.Assert(t, strings.Contains(res.Combined(), `Container foo_c Created`), res.Combined())
193+
assert.Assert(t, !strings.Contains(res.Combined(), `Container bar_c Created`), res.Combined())
194+
}

0 commit comments

Comments
 (0)