Skip to content

Commit 6f719b0

Browse files
author
Aleix Penella
committed
testing docker compose project name
1 parent 8fcd2aa commit 6f719b0

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

modules/docker/docker_compose_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,40 @@ func TestDockerComposeWithBuildKit(t *testing.T) {
2525

2626
require.Contains(t, out, testToken)
2727
}
28+
29+
func TestDockerComposeWithCustomProjectName(t *testing.T) {
30+
t.Parallel()
31+
32+
tests := []struct {
33+
name string
34+
options *Options
35+
expected string
36+
}{
37+
{
38+
name: "Testing ",
39+
options: &Options{
40+
WorkingDir: "../../test/fixtures/docker-compose-with-custom-project-name",
41+
},
42+
expected: "testdockercomposewithcustomprojectname",
43+
},
44+
{
45+
name: "Testing",
46+
options: &Options{
47+
WorkingDir: "../../test/fixtures/docker-compose-with-custom-project-name",
48+
ProjectName: "testingProjectName",
49+
},
50+
expected: "testingprojectname",
51+
},
52+
}
53+
54+
for _, test := range tests {
55+
t.Run(test.name, func(t *testing.T) {
56+
t.Log(test.name)
57+
58+
output := RunDockerCompose(t, test.options, "up", "-d")
59+
defer RunDockerCompose(t, test.options, "down", "--remove-orphans", "--timeout", "2")
60+
61+
require.Contains(t, output, test.expected)
62+
})
63+
}
64+
}

0 commit comments

Comments
 (0)