e2e test for --all-resources

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2024-04-09 15:04:35 +02:00 committed by Nicolas De loof
parent 865a64afea
commit b4280fb561
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,5 @@
volumes:
my_vol: {}
networks:
my_net: {}

View File

@ -22,6 +22,7 @@ package e2e
import (
"context"
"errors"
"fmt"
"os/exec"
"strings"
"syscall"
@ -165,3 +166,15 @@ func TestUpWithDependencyNotRequired(t *testing.T) {
assert.Assert(t, strings.Contains(res.Combined(), "foo"), res.Combined())
assert.Assert(t, strings.Contains(res.Combined(), " optional dependency \"bar\" failed to start"), res.Combined())
}
func TestUpWithAllResources(t *testing.T) {
c := NewCLI(t)
const projectName = "compose-e2e-all-resources"
t.Cleanup(func() {
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "-v")
})
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/resources/compose.yaml", "--all-resources", "--project-name", projectName, "up")
assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol" Created`, projectName)), res.Combined())
assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net Created`, projectName)), res.Combined())
}