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

Function TestIPAMConfig

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

Source from the content-addressed store, hash-verified

110}
111
112func TestIPAMConfig(t *testing.T) {
113 c := NewParallelCLI(t)
114
115 const projectName = "ipam_e2e"
116
117 t.Run("ensure we do not reuse previous networks", func(t *testing.T) {
118 c.RunDockerOrExitError(t, "network", "rm", projectName+"_default")
119 })
120
121 t.Run("up", func(t *testing.T) {
122 c.RunDockerComposeCmd(t, "-f", "./fixtures/ipam/compose.yaml", "--project-name", projectName, "up", "-d")
123 })
124
125 t.Run("ensure service get fixed IP assigned", func(t *testing.T) {
126 res := c.RunDockerCmd(t, "inspect", projectName+"-foo-1", "-f",
127 fmt.Sprintf(`{{ $network := index .NetworkSettings.Networks "%s_default" }}{{ $network.IPAMConfig.IPv4Address }}`, projectName))
128 res.Assert(t, icmd.Expected{Out: "10.1.0.100"})
129 })
130
131 t.Run("down", func(t *testing.T) {
132 _ = c.RunDockerComposeCmd(t, "--project-name", projectName, "down")
133 })
134}
135
136func TestNetworkModes(t *testing.T) {
137 // fixture is shared with TestNetworks and is not safe to run concurrently

Callers

nothing calls this directly

Calls 4

NewParallelCLIFunction · 0.85
RunDockerOrExitErrorMethod · 0.80
RunDockerComposeCmdMethod · 0.80
RunDockerCmdMethod · 0.80

Tested by

no test coverage detected