Becuase I'm about to add tests that use netlink, and the netlink
package breaks compilation under Windows.
Signed-off-by: Rob Murray <rob.murray@docker.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+package daemon // import "github.com/docker/docker/integration/daemon" |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "testing" |
|
| 4 |
+ |
|
| 5 |
+ "github.com/docker/docker/testutil" |
|
| 6 |
+ "github.com/docker/docker/testutil/daemon" |
|
| 7 |
+ "gotest.tools/v3/icmd" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+func TestDaemonDefaultBridgeWithFixedCidrButNoBip(t *testing.T) {
|
|
| 11 |
+ ctx := testutil.StartSpan(baseContext, t) |
|
| 12 |
+ |
|
| 13 |
+ bridgeName := "ext-bridge1" |
|
| 14 |
+ d := daemon.New(t, daemon.WithEnvVars("DOCKER_TEST_CREATE_DEFAULT_BRIDGE="+bridgeName))
|
|
| 15 |
+ defer func() {
|
|
| 16 |
+ d.Stop(t) |
|
| 17 |
+ d.Cleanup(t) |
|
| 18 |
+ }() |
|
| 19 |
+ |
|
| 20 |
+ defer func() {
|
|
| 21 |
+ // No need to clean up when running this test in rootless mode, as the |
|
| 22 |
+ // interface is deleted when the daemon is stopped and the netns |
|
| 23 |
+ // reclaimed by the kernel. |
|
| 24 |
+ if !testEnv.IsRootless() {
|
|
| 25 |
+ deleteInterface(t, bridgeName) |
|
| 26 |
+ } |
|
| 27 |
+ }() |
|
| 28 |
+ d.StartWithBusybox(ctx, t, "--bridge", bridgeName, "--fixed-cidr", "192.168.130.0/24") |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+func deleteInterface(t *testing.T, ifName string) {
|
|
| 32 |
+ icmd.RunCommand("ip", "link", "delete", ifName).Assert(t, icmd.Success)
|
|
| 33 |
+ icmd.RunCommand("iptables", "-t", "nat", "--flush").Assert(t, icmd.Success)
|
|
| 34 |
+ icmd.RunCommand("iptables", "--flush").Assert(t, icmd.Success)
|
|
| 35 |
+} |
| ... | ... |
@@ -699,32 +699,3 @@ func testLiveRestoreUserChainsSetup(t *testing.T) {
|
| 699 | 699 |
assert.Check(t, is.Equal(strings.TrimSpace(result.Stdout()), "-A FORWARD -j DOCKER-USER"), "the jump to DOCKER-USER should be the first rule in the FORWARD chain") |
| 700 | 700 |
}) |
| 701 | 701 |
} |
| 702 |
- |
|
| 703 |
-func TestDaemonDefaultBridgeWithFixedCidrButNoBip(t *testing.T) {
|
|
| 704 |
- skip.If(t, runtime.GOOS == "windows") |
|
| 705 |
- |
|
| 706 |
- ctx := testutil.StartSpan(baseContext, t) |
|
| 707 |
- |
|
| 708 |
- bridgeName := "ext-bridge1" |
|
| 709 |
- d := daemon.New(t, daemon.WithEnvVars("DOCKER_TEST_CREATE_DEFAULT_BRIDGE="+bridgeName))
|
|
| 710 |
- defer func() {
|
|
| 711 |
- d.Stop(t) |
|
| 712 |
- d.Cleanup(t) |
|
| 713 |
- }() |
|
| 714 |
- |
|
| 715 |
- defer func() {
|
|
| 716 |
- // No need to clean up when running this test in rootless mode, as the |
|
| 717 |
- // interface is deleted when the daemon is stopped and the netns |
|
| 718 |
- // reclaimed by the kernel. |
|
| 719 |
- if !testEnv.IsRootless() {
|
|
| 720 |
- deleteInterface(t, bridgeName) |
|
| 721 |
- } |
|
| 722 |
- }() |
|
| 723 |
- d.StartWithBusybox(ctx, t, "--bridge", bridgeName, "--fixed-cidr", "192.168.130.0/24") |
|
| 724 |
-} |
|
| 725 |
- |
|
| 726 |
-func deleteInterface(t *testing.T, ifName string) {
|
|
| 727 |
- icmd.RunCommand("ip", "link", "delete", ifName).Assert(t, icmd.Success)
|
|
| 728 |
- icmd.RunCommand("iptables", "-t", "nat", "--flush").Assert(t, icmd.Success)
|
|
| 729 |
- icmd.RunCommand("iptables", "--flush").Assert(t, icmd.Success)
|
|
| 730 |
-} |