MCPcopy
hub / github.com/docker/compose / TestConfigFromEnv

Function TestConfigFromEnv

pkg/e2e/configs_test.go:25–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestConfigFromEnv(t *testing.T) {
26 c := NewParallelCLI(t)
27 defer c.cleanupWithDown(t, "configs")
28
29 t.Run("config from file", func(t *testing.T) {
30 res := icmd.RunCmd(c.NewDockerComposeCmd(t, "-f", "./fixtures/configs/compose.yaml", "run", "from_file"))
31 res.Assert(t, icmd.Expected{Out: "This is my config file"})
32 })
33
34 t.Run("config from env", func(t *testing.T) {
35 res := icmd.RunCmd(c.NewDockerComposeCmd(t, "-f", "./fixtures/configs/compose.yaml", "run", "from_env"),
36 func(cmd *icmd.Cmd) {
37 cmd.Env = append(cmd.Env, "CONFIG=config")
38 })
39 res.Assert(t, icmd.Expected{Out: "config"})
40 })
41
42 t.Run("config inlined", func(t *testing.T) {
43 res := icmd.RunCmd(c.NewDockerComposeCmd(t, "-f", "./fixtures/configs/compose.yaml", "run", "inlined"),
44 func(cmd *icmd.Cmd) {
45 cmd.Env = append(cmd.Env, "CONFIG=config")
46 })
47 res.Assert(t, icmd.Expected{Out: "This is my config"})
48 })
49
50 t.Run("custom target", func(t *testing.T) {
51 res := icmd.RunCmd(c.NewDockerComposeCmd(t, "-f", "./fixtures/configs/compose.yaml", "run", "target"),
52 func(cmd *icmd.Cmd) {
53 cmd.Env = append(cmd.Env, "CONFIG=config")
54 })
55 res.Assert(t, icmd.Expected{Out: "This is my config"})
56 })
57}

Callers

nothing calls this directly

Calls 4

NewParallelCLIFunction · 0.85
cleanupWithDownMethod · 0.80
RunCmdMethod · 0.80
NewDockerComposeCmdMethod · 0.80

Tested by

no test coverage detected