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

Function TestComposeFileSetByEnvFile

pkg/e2e/compose_test.go:346–368  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

344}
345
346func TestComposeFileSetByEnvFile(t *testing.T) {
347 c := NewCLI(t)
348 defer c.cleanupWithDown(t, "dotenv")
349
350 dotEnv, err := os.CreateTemp(t.TempDir(), ".env")
351 assert.NilError(t, err)
352 err = os.WriteFile(dotEnv.Name(), []byte(`
353COMPOSE_FILE=fixtures/dotenv/development/compose.yaml
354IMAGE_NAME=test
355IMAGE_TAG=latest
356COMPOSE_PROFILES=test
357`), 0o700)
358 assert.NilError(t, err)
359
360 cmd := c.NewDockerComposeCmd(t, "--env-file", dotEnv.Name(), "config")
361 res := icmd.RunCmd(cmd)
362 res.Assert(t, icmd.Expected{
363 Out: "image: test:latest",
364 })
365 res.Assert(t, icmd.Expected{
366 Out: "image: enabled:profile",
367 })
368}
369
370func TestNestedDotEnv(t *testing.T) {
371 c := NewCLI(t)

Callers

nothing calls this directly

Calls 7

cleanupWithDownMethod · 0.95
NewDockerComposeCmdMethod · 0.95
NewCLIFunction · 0.85
TempDirMethod · 0.80
WriteFileMethod · 0.80
RunCmdMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected