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

Function TestNetworkConfigChanged

pkg/e2e/networks_test.go:149–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestNetworkConfigChanged(t *testing.T) {
150 // fixture is shared with TestNetworks and is not safe to run concurrently
151 c := NewCLI(t)
152 const projectName = "network_config_change"
153
154 c.RunDockerComposeCmd(t, "-f", "./fixtures/network-test/compose.subnet.yaml", "--project-name", projectName, "up", "-d")
155 t.Cleanup(func() {
156 c.RunDockerComposeCmd(t, "--project-name", projectName, "down")
157 })
158
159 res := c.RunDockerComposeCmd(t, "--project-name", projectName, "exec", "test", "hostname", "-i")
160 res.Assert(t, icmd.Expected{Out: "172.99.0."})
161 res.Combined()
162
163 cmd := c.NewCmdWithEnv([]string{"SUBNET=192.168.0.0/16"},
164 "docker", "compose", "-f", "./fixtures/network-test/compose.subnet.yaml", "--project-name", projectName, "up", "-d")
165 res = icmd.RunCmd(cmd)
166 res.Assert(t, icmd.Success)
167 out := res.Combined()
168 fmt.Println(out)
169
170 res = c.RunDockerComposeCmd(t, "--project-name", projectName, "exec", "test", "hostname", "-i")
171 res.Assert(t, icmd.Expected{Out: "192.168.0."})
172}
173
174func TestMacAddress(t *testing.T) {
175 c := NewCLI(t)

Callers

nothing calls this directly

Calls 4

RunDockerComposeCmdMethod · 0.95
NewCmdWithEnvMethod · 0.95
NewCLIFunction · 0.85
RunCmdMethod · 0.80

Tested by

no test coverage detected