e2e: add tests

Signed-off-by: Alessio Perugini <alessio@perugini.xyz>
This commit is contained in:
Alessio Perugini 2025-05-06 19:42:25 +02:00 committed by Nicolas De loof
parent d6e3fa6d74
commit f0f47a8aa8
2 changed files with 22 additions and 1 deletions

View File

@ -416,7 +416,7 @@ func runVariables(ctx context.Context, dockerCli command.Cli, opts configOptions
if err != nil { if err != nil {
return err return err
} }
fmt.Println(string(result)) fmt.Print(string(result))
return nil return nil
} }

View File

@ -46,4 +46,25 @@ func TestLocalComposeConfig(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--no-interpolate") res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--no-interpolate")
res.Assert(t, icmd.Expected{Out: `- ${PORT:-8080}:80`}) res.Assert(t, icmd.Expected{Out: `- ${PORT:-8080}:80`})
}) })
t.Run("--variables --format json", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "json")
res.Assert(t, icmd.Expected{Out: `{
"PORT": {
"Name": "PORT",
"DefaultValue": "8080",
"PresenceValue": "",
"Required": false
}
}`})
})
t.Run("--variables --format yaml", func(t *testing.T) {
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "yaml")
res.Assert(t, icmd.Expected{Out: `PORT:
name: PORT
defaultvalue: "8080"
presencevalue: ""
required: false`})
})
} }