Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit fae5df6

Browse files
committed
Add e2e test for the init with an invalid file
Signed-off-by: Djordje Lukic <[email protected]>
1 parent 5d2b833 commit fae5df6

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

e2e/commands_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@ maintainers:
226226
golden.Assert(t, stdOut, "validate-output.golden")
227227
}
228228

229+
func TestInitWithInvalidCompose(t *testing.T) {
230+
cmd, cleanup := dockerCli.createTestCmd()
231+
defer cleanup()
232+
composePath := filepath.Join("testdata", "invalid-compose", "docker-compose.yml")
233+
234+
cmd.Command = dockerCli.Command("app", "init", "invalid", "--compose-file", composePath)
235+
stdOut := icmd.RunCmd(cmd).Assert(t, icmd.Expected{
236+
ExitCode: 1,
237+
}).Combined()
238+
golden.Assert(t, stdOut, "init-invalid-output.golden")
239+
}
240+
229241
func TestInspectApp(t *testing.T) {
230242
runWithDindSwarmAndRegistry(t, func(info dindSwarmAndRegistryInfo) {
231243
cmd := info.configuredCmd
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Compose file validation failed:
2+
* can't use relative path as volume source ("./src:/src") in service "api"
3+
* can't use relative path as volume source ("./static:/opt/${static_subdir}") in service "web"
4+
* secret "my_secret" should be external
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3.6"
2+
services:
3+
api:
4+
image: python:3.6
5+
volumes:
6+
- ./src:/src
7+
web:
8+
image: nginx
9+
networks:
10+
- front
11+
volumes:
12+
- ./static:/opt/${static_subdir}
13+
secrets:
14+
my_secret:
15+
first: ./path/to/secret.txt

0 commit comments

Comments
 (0)