Remove test env var DOCKER_TEST_CREATE_DEFAULT_BRIDGE

Env var DOCKER_TEST_CREATE_DEFAULT_BRIDGE could be set to
override the name of the default bridge - without the bridge
being user-managed (unlike the '--bridge' daemon option).

It was needed by tests looking at docker0 behaviour, using
their own instance of the daemon, without breaking the
docker0 instance belonging to CI's daemon.

Now, those tests run in their own netns using the name docker0.

So, remove the unused env var.

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray
2024-12-04 11:28:48 +00:00
parent 0eb3d431c0
commit 8fee8a759f
2 changed files with 1 additions and 21 deletions

View File

@@ -1043,18 +1043,6 @@ func getDefaultBridgeName(cfg config.BridgeConfig) (bridgeName string, userManag
// create it, and it is not possible to supply an address using --bip.
return cfg.Iface, true
}
// Without a --bridge, the bridge is "docker0", created and managed by the
// daemon. A --bip (cidr) can be supplied to define the bridge's IP address
// and the network's subnet.
//
// Env var DOCKER_TEST_CREATE_DEFAULT_BRIDGE env var modifies the default
// bridge name. Unlike '--bridge', the bridge does not need to be created
// outside the daemon, and it's still possible to use '--bip'. It is
// intended only for use in moby tests; it may be removed, its behaviour
// may be modified, and it may not do what you want anyway!
if bn := os.Getenv("DOCKER_TEST_CREATE_DEFAULT_BRIDGE"); bn != "" {
return bn, false
}
return bridge.DefaultBridgeName, false
}

View File

@@ -15,15 +15,7 @@ import (
// SetupDevice create a new bridge interface/
func setupDevice(config *networkConfiguration, i *bridgeInterface) error {
// We only attempt to create the bridge when the requested device name is
// the default one. The default bridge name can be overridden with the
// DOCKER_TEST_CREATE_DEFAULT_BRIDGE env var. It should be used only for
// test purpose.
var defaultBridgeName string
if defaultBridgeName = os.Getenv("DOCKER_TEST_CREATE_DEFAULT_BRIDGE"); defaultBridgeName == "" {
defaultBridgeName = DefaultBridgeName
}
if config.BridgeName != defaultBridgeName && config.DefaultBridge {
if config.BridgeName != DefaultBridgeName && config.DefaultBridge {
return NonDefaultBridgeExistError(config.BridgeName)
}