Skip to content

Commit f0f47a8

Browse files
alessio-peruginindeloof
authored andcommitted
e2e: add tests
Signed-off-by: Alessio Perugini <alessio@perugini.xyz>
1 parent d6e3fa6 commit f0f47a8

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

cmd/compose/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ func runVariables(ctx context.Context, dockerCli command.Cli, opts configOptions
416416
if err != nil {
417417
return err
418418
}
419-
fmt.Println(string(result))
419+
fmt.Print(string(result))
420420
return nil
421421
}
422422

pkg/e2e/config_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,25 @@ func TestLocalComposeConfig(t *testing.T) {
4646
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--no-interpolate")
4747
res.Assert(t, icmd.Expected{Out: `- ${PORT:-8080}:80`})
4848
})
49+
50+
t.Run("--variables --format json", func(t *testing.T) {
51+
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "json")
52+
res.Assert(t, icmd.Expected{Out: `{
53+
"PORT": {
54+
"Name": "PORT",
55+
"DefaultValue": "8080",
56+
"PresenceValue": "",
57+
"Required": false
58+
}
59+
}`})
60+
})
61+
62+
t.Run("--variables --format yaml", func(t *testing.T) {
63+
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "yaml")
64+
res.Assert(t, icmd.Expected{Out: `PORT:
65+
name: PORT
66+
defaultvalue: "8080"
67+
presencevalue: ""
68+
required: false`})
69+
})
4970
}

0 commit comments

Comments
 (0)