diff options
author | Brian Goff <cpuguy83@gmail.com> | 2023-04-25 11:07:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 11:07:57 -0700 |
commit | 0970cb054c9606c727dda5240750482d0f40f729 (patch) | |
tree | cc5632179c73ba70b346181eb9b13ff1a708aabf /integration | |
parent | 801202349ab04a329c32da5612f230689c54eb91 (diff) | |
parent | 2d31697d82df61ab78b583818f4106c36cf20cec (diff) | |
download | docker-0970cb054c9606c727dda5240750482d0f40f729.tar.gz |
Merge pull request #45366 from akerouanton/fix-docker0-PreferredPool
daemon: set docker0 subpool as the IPAM pool
Diffstat (limited to 'integration')
-rw-r--r-- | integration/daemon/daemon_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/integration/daemon/daemon_test.go b/integration/daemon/daemon_test.go index 2242d3d4f1..7ecb2c0aa4 100644 --- a/integration/daemon/daemon_test.go +++ b/integration/daemon/daemon_test.go @@ -21,6 +21,7 @@ import ( "github.com/docker/docker/testutil/daemon" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" + "gotest.tools/v3/icmd" "gotest.tools/v3/skip" ) @@ -400,3 +401,30 @@ func testLiveRestoreVolumeReferences(t *testing.T) { runTest(t, "no") }) } + +func TestDaemonDefaultBridgeWithFixedCidrButNoBip(t *testing.T) { + skip.If(t, runtime.GOOS == "windows") + + bridgeName := "ext-bridge1" + d := daemon.New(t, daemon.WithEnvVars("DOCKER_TEST_CREATE_DEFAULT_BRIDGE="+bridgeName)) + defer func() { + d.Stop(t) + d.Cleanup(t) + }() + + defer func() { + // No need to clean up when running this test in rootless mode, as the + // interface is deleted when the daemon is stopped and the netns + // reclaimed by the kernel. + if !testEnv.IsRootless() { + deleteInterface(t, bridgeName) + } + }() + d.StartWithBusybox(t, "--bridge", bridgeName, "--fixed-cidr", "192.168.130.0/24") +} + +func deleteInterface(t *testing.T, ifName string) { + icmd.RunCommand("ip", "link", "delete", ifName).Assert(t, icmd.Success) + icmd.RunCommand("iptables", "-t", "nat", "--flush").Assert(t, icmd.Success) + icmd.RunCommand("iptables", "--flush").Assert(t, icmd.Success) +} |