Skip to content

Commit a261682

Browse files
committed
e2e: fix per-command env overrides
Signed-off-by: Milas Bowman <[email protected]>
1 parent ccd8731 commit a261682

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/e2e/compose_environment_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ func TestEnvPriority(t *testing.T) {
4545
cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/environment/env-priority/compose-with-env.yaml",
4646
"--project-directory", projectDir, "--env-file", "./fixtures/environment/env-priority/.env.override", "run",
4747
"--rm", "-e", "WHEREAMI", "env-compose-priority")
48-
res := icmd.RunCmd(cmd, icmd.WithEnv("WHEREAMI=shell"))
48+
cmd.Env = append(cmd.Env, "WHEREAMI=shell")
49+
res := icmd.RunCmd(cmd)
4950
assert.Equal(t, strings.TrimSpace(res.Stdout()), "Compose File")
5051
})
5152

@@ -59,7 +60,8 @@ func TestEnvPriority(t *testing.T) {
5960
cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/environment/env-priority/compose.yaml", "--project-directory",
6061
projectDir, "--env-file", "./fixtures/environment/env-priority/.env.override", "run", "--rm", "-e",
6162
"WHEREAMI", "env-compose-priority")
62-
res := icmd.RunCmd(cmd, icmd.WithEnv("WHEREAMI=shell"))
63+
cmd.Env = append(cmd.Env, "WHEREAMI=shell")
64+
res := icmd.RunCmd(cmd)
6365
assert.Equal(t, strings.TrimSpace(res.Stdout()), "shell")
6466
})
6567

@@ -133,7 +135,8 @@ func TestEnvInterpolation(t *testing.T) {
133135
t.Run("shell priority from run command", func(t *testing.T) {
134136
cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/environment/env-interpolation/compose.yaml",
135137
"--project-directory", projectDir, "config")
136-
res := icmd.RunCmd(cmd, icmd.WithEnv("WHEREAMI=shell"))
138+
cmd.Env = append(cmd.Env, "WHEREAMI=shell")
139+
res := icmd.RunCmd(cmd)
137140
res.Assert(t, icmd.Expected{Out: `IMAGE: default_env:shell`})
138141
})
139142
}

0 commit comments

Comments
 (0)