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

Function TestScaleWithDepsCases

pkg/e2e/scale_test.go:70–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestScaleWithDepsCases(t *testing.T) {
71 c := NewCLI(t, WithEnv(
72 "COMPOSE_PROJECT_NAME=scale-deps-tests"))
73
74 reset := func() {
75 c.RunDockerComposeCmd(t, "down", "--rmi", "all")
76 }
77 t.Cleanup(reset)
78 res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/scale", "up", "-d", "--scale", "db=2")
79 res.Assert(t, icmd.Success)
80
81 res = c.RunDockerComposeCmd(t, "ps")
82 checkServiceContainer(t, res.Combined(), "scale-deps-tests-db", NO_STATE_TO_CHECK, 2)
83
84 t.Log("scale up 1 service with --no-deps")
85 _ = c.RunDockerComposeCmd(t, "--project-directory", "fixtures/scale", "scale", "--no-deps", "back=2")
86 res = c.RunDockerComposeCmd(t, "ps")
87 checkServiceContainer(t, res.Combined(), "scale-deps-tests-back", NO_STATE_TO_CHECK, 2)
88 checkServiceContainer(t, res.Combined(), "scale-deps-tests-db", NO_STATE_TO_CHECK, 2)
89
90 t.Log("scale up 1 service without --no-deps")
91 _ = c.RunDockerComposeCmd(t, "--project-directory", "fixtures/scale", "scale", "back=2")
92 res = c.RunDockerComposeCmd(t, "ps")
93 checkServiceContainer(t, res.Combined(), "scale-deps-tests-back", NO_STATE_TO_CHECK, 2)
94 checkServiceContainer(t, res.Combined(), "scale-deps-tests-db", NO_STATE_TO_CHECK, 1)
95}
96
97func TestScaleUpAndDownPreserveContainerNumber(t *testing.T) {
98 const projectName = "scale-up-down-test"

Callers

nothing calls this directly

Calls 5

RunDockerComposeCmdMethod · 0.95
NewCLIFunction · 0.85
WithEnvFunction · 0.85
checkServiceContainerFunction · 0.85
LogMethod · 0.65

Tested by

no test coverage detected