|
|
@@ -222,3 +222,24 @@ func TestCommentsInEnvFile(t *testing.T) {
|
|
|
c.RunDockerComposeCmd(t, "--project-name", "env-file-comments", "down", "--rmi", "all")
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+func TestUnsetEnv(t *testing.T) {
|
|
|
+ c := NewParallelCLI(t)
|
|
|
+ t.Cleanup(func() {
|
|
|
+ c.RunDockerComposeCmd(t, "--project-name", "empty-variable", "down", "--rmi", "all")
|
|
|
+ })
|
|
|
+
|
|
|
+ t.Run("override env variable", func(t *testing.T) {
|
|
|
+ c.RunDockerComposeCmd(t, "-f", "./fixtures/environment/empty-variable/compose.yaml", "build")
|
|
|
+
|
|
|
+ res := c.RunDockerComposeCmd(t, "-f", "./fixtures/environment/empty-variable/compose.yaml",
|
|
|
+ "run", "-e", "EMPTY=hello", "--rm", "empty-variable")
|
|
|
+ res.Assert(t, icmd.Expected{Out: `=hello=`})
|
|
|
+ })
|
|
|
+
|
|
|
+ t.Run("unset env variable", func(t *testing.T) {
|
|
|
+ res := c.RunDockerComposeCmd(t, "-f", "./fixtures/environment/empty-variable/compose.yaml",
|
|
|
+ "run", "--rm", "empty-variable")
|
|
|
+ res.Assert(t, icmd.Expected{Out: `==`})
|
|
|
+ })
|
|
|
+}
|