Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -840,22 +840,6 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainer |
| 840 | 840 |
s.d.Restart(c) |
| 841 | 841 |
} |
| 842 | 842 |
|
| 843 |
-func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *testing.T) {
|
|
| 844 |
- |
|
| 845 |
- // Start daemon without docker0 bridge |
|
| 846 |
- defaultNetworkBridge := "docker0" |
|
| 847 |
- deleteInterface(c, defaultNetworkBridge) |
|
| 848 |
- |
|
| 849 |
- discoveryBackend := "consul://consuladdr:consulport/some/path" |
|
| 850 |
- s.d.Start(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
|
|
| 851 |
- |
|
| 852 |
- // Start daemon with docker0 bridge |
|
| 853 |
- result := icmd.RunCommand("ifconfig", defaultNetworkBridge)
|
|
| 854 |
- result.Assert(c, icmd.Success) |
|
| 855 |
- |
|
| 856 |
- s.d.Restart(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
|
|
| 857 |
-} |
|
| 858 |
- |
|
| 859 | 843 |
func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
|
| 860 | 844 |
d := s.d |
| 861 | 845 |
|
| ... | ... |
@@ -2229,51 +2213,6 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *testing.T) {
|
| 2229 | 2229 |
assert.Assert(c, strings.Contains(b.String(), debugLog)) |
| 2230 | 2230 |
} |
| 2231 | 2231 |
|
| 2232 |
-func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) {
|
|
| 2233 |
- testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) |
|
| 2234 |
- |
|
| 2235 |
- // daemon config file |
|
| 2236 |
- daemonConfig := `{ "debug" : false }`
|
|
| 2237 |
- configFile, err := os.CreateTemp("", "test-daemon-discovery-backend-config-reload-config")
|
|
| 2238 |
- assert.Assert(c, err == nil, "could not create temp file for config reload") |
|
| 2239 |
- configFilePath := configFile.Name() |
|
| 2240 |
- defer func() {
|
|
| 2241 |
- configFile.Close() |
|
| 2242 |
- os.RemoveAll(configFile.Name()) |
|
| 2243 |
- }() |
|
| 2244 |
- |
|
| 2245 |
- _, err = configFile.Write([]byte(daemonConfig)) |
|
| 2246 |
- assert.NilError(c, err) |
|
| 2247 |
- |
|
| 2248 |
- // --log-level needs to be set so that d.Start() doesn't add --debug causing |
|
| 2249 |
- // a conflict with the config |
|
| 2250 |
- s.d.Start(c, "--config-file", configFilePath, "--log-level=info") |
|
| 2251 |
- |
|
| 2252 |
- // daemon config file |
|
| 2253 |
- daemonConfig = `{
|
|
| 2254 |
- "cluster-store": "consul://consuladdr:consulport/some/path", |
|
| 2255 |
- "cluster-advertise": "192.168.56.100:0", |
|
| 2256 |
- "debug" : false |
|
| 2257 |
- }` |
|
| 2258 |
- |
|
| 2259 |
- err = configFile.Truncate(0) |
|
| 2260 |
- assert.NilError(c, err) |
|
| 2261 |
- _, err = configFile.Seek(0, io.SeekStart) |
|
| 2262 |
- assert.NilError(c, err) |
|
| 2263 |
- |
|
| 2264 |
- _, err = configFile.Write([]byte(daemonConfig)) |
|
| 2265 |
- assert.NilError(c, err) |
|
| 2266 |
- |
|
| 2267 |
- err = s.d.ReloadConfig() |
|
| 2268 |
- assert.Assert(c, err == nil, "error reloading daemon config") |
|
| 2269 |
- |
|
| 2270 |
- out, err := s.d.Cmd("info")
|
|
| 2271 |
- assert.NilError(c, err) |
|
| 2272 |
- |
|
| 2273 |
- assert.Assert(c, strings.Contains(out, "Cluster Store: consul://consuladdr:consulport/some/path")) |
|
| 2274 |
- assert.Assert(c, strings.Contains(out, "Cluster Advertise: 192.168.56.100:0")) |
|
| 2275 |
-} |
|
| 2276 |
- |
|
| 2277 | 2232 |
// Test for #21956 |
| 2278 | 2233 |
func (s *DockerDaemonSuite) TestDaemonLogOptions(c *testing.T) {
|
| 2279 | 2234 |
s.d.StartWithBusybox(c, "--log-driver=syslog", "--log-opt=syslog-address=udp://127.0.0.1:514") |
| ... | ... |
@@ -415,9 +415,6 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
|
| 415 | 415 |
expectedSubstrings := []string{
|
| 416 | 416 |
" daemon reload " + info.ID + " ", |
| 417 | 417 |
"(allow-nondistributable-artifacts=[", |
| 418 |
- " cluster-advertise=, ", |
|
| 419 |
- " cluster-store=, ", |
|
| 420 |
- " cluster-store-opts=", |
|
| 421 | 418 |
" debug=true, ", |
| 422 | 419 |
" default-ipc-mode=", |
| 423 | 420 |
" default-runtime=", |
| ... | ... |
@@ -152,16 +152,10 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
|
| 152 | 152 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) |
| 153 | 153 |
d.Stop(c) |
| 154 | 154 |
|
| 155 |
- // start a daemon with --cluster-store and --cluster-advertise |
|
| 156 |
- err := d.StartWithError("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=1.1.1.1:2375")
|
|
| 157 |
- assert.ErrorContains(c, err, "") |
|
| 158 |
- content, err := d.ReadLogFile() |
|
| 159 |
- assert.NilError(c, err) |
|
| 160 |
- assert.Assert(c, strings.Contains(string(content), "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode")) |
|
| 161 | 155 |
// start a daemon with --live-restore |
| 162 |
- err = d.StartWithError("--live-restore")
|
|
| 156 |
+ err := d.StartWithError("--live-restore")
|
|
| 163 | 157 |
assert.ErrorContains(c, err, "") |
| 164 |
- content, err = d.ReadLogFile() |
|
| 158 |
+ content, err := d.ReadLogFile() |
|
| 165 | 159 |
assert.NilError(c, err) |
| 166 | 160 |
assert.Assert(c, strings.Contains(string(content), "--live-restore daemon configuration is incompatible with swarm mode")) |
| 167 | 161 |
// restart for teardown |
| ... | ... |
@@ -5,16 +5,12 @@ package system // import "github.com/docker/docker/integration/system" |
| 5 | 5 |
|
| 6 | 6 |
import ( |
| 7 | 7 |
"context" |
| 8 |
- "fmt" |
|
| 9 |
- "net" |
|
| 10 | 8 |
"net/http" |
| 11 | 9 |
"testing" |
| 12 | 10 |
|
| 13 |
- "github.com/docker/docker/testutil/daemon" |
|
| 14 | 11 |
req "github.com/docker/docker/testutil/request" |
| 15 | 12 |
"gotest.tools/v3/assert" |
| 16 | 13 |
is "gotest.tools/v3/assert/cmp" |
| 17 |
- "gotest.tools/v3/skip" |
|
| 18 | 14 |
) |
| 19 | 15 |
|
| 20 | 16 |
func TestInfoBinaryCommits(t *testing.T) {
|
| ... | ... |
@@ -48,72 +44,3 @@ func TestInfoAPIVersioned(t *testing.T) {
|
| 48 | 48 |
assert.Check(t, is.Contains(out, "ExecutionDriver")) |
| 49 | 49 |
assert.Check(t, is.Contains(out, "not supported")) |
| 50 | 50 |
} |
| 51 |
- |
|
| 52 |
-// TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and |
|
| 53 |
-// `--cluster-store` properly returns the backend's endpoint in info output. |
|
| 54 |
-func TestInfoDiscoveryBackend(t *testing.T) {
|
|
| 55 |
- skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
|
| 56 |
- |
|
| 57 |
- const ( |
|
| 58 |
- discoveryBackend = "consul://consuladdr:consulport/some/path" |
|
| 59 |
- discoveryAdvertise = "1.1.1.1:2375" |
|
| 60 |
- ) |
|
| 61 |
- |
|
| 62 |
- d := daemon.New(t) |
|
| 63 |
- d.Start(t, "--cluster-store="+discoveryBackend, "--cluster-advertise="+discoveryAdvertise) |
|
| 64 |
- defer d.Stop(t) |
|
| 65 |
- |
|
| 66 |
- info := d.Info(t) |
|
| 67 |
- assert.Equal(t, info.ClusterStore, discoveryBackend) |
|
| 68 |
- assert.Equal(t, info.ClusterAdvertise, discoveryAdvertise) |
|
| 69 |
-} |
|
| 70 |
- |
|
| 71 |
-// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with |
|
| 72 |
-// an invalid `--cluster-advertise` configuration |
|
| 73 |
-func TestInfoDiscoveryInvalidAdvertise(t *testing.T) {
|
|
| 74 |
- skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
|
| 75 |
- d := daemon.New(t) |
|
| 76 |
- |
|
| 77 |
- // --cluster-advertise with an invalid string is an error |
|
| 78 |
- err := d.StartWithError("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=invalid")
|
|
| 79 |
- if err == nil {
|
|
| 80 |
- d.Stop(t) |
|
| 81 |
- } |
|
| 82 |
- assert.ErrorContains(t, err, "", "expected error when starting daemon") |
|
| 83 |
- |
|
| 84 |
- // --cluster-advertise without --cluster-store is also an error |
|
| 85 |
- err = d.StartWithError("--cluster-advertise=1.1.1.1:2375")
|
|
| 86 |
- if err == nil {
|
|
| 87 |
- d.Stop(t) |
|
| 88 |
- } |
|
| 89 |
- assert.ErrorContains(t, err, "", "expected error when starting daemon") |
|
| 90 |
-} |
|
| 91 |
- |
|
| 92 |
-// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise` |
|
| 93 |
-// configured with interface name properly show the advertise ip-address in info output. |
|
| 94 |
-func TestInfoDiscoveryAdvertiseInterfaceName(t *testing.T) {
|
|
| 95 |
- skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
|
| 96 |
- skip.If(t, testEnv.IsRootless, "rootless mode has different view of network") |
|
| 97 |
- // TODO should we check for networking availability (integration-cli suite checks for networking through `Network()`) |
|
| 98 |
- |
|
| 99 |
- d := daemon.New(t) |
|
| 100 |
- const ( |
|
| 101 |
- discoveryStore = "consul://consuladdr:consulport/some/path" |
|
| 102 |
- discoveryInterface = "eth0" |
|
| 103 |
- ) |
|
| 104 |
- |
|
| 105 |
- d.Start(t, "--cluster-store="+discoveryStore, fmt.Sprintf("--cluster-advertise=%s:2375", discoveryInterface))
|
|
| 106 |
- defer d.Stop(t) |
|
| 107 |
- |
|
| 108 |
- iface, err := net.InterfaceByName(discoveryInterface) |
|
| 109 |
- assert.NilError(t, err) |
|
| 110 |
- addrs, err := iface.Addrs() |
|
| 111 |
- assert.NilError(t, err) |
|
| 112 |
- assert.Assert(t, len(addrs) > 0) |
|
| 113 |
- ip, _, err := net.ParseCIDR(addrs[0].String()) |
|
| 114 |
- assert.NilError(t, err) |
|
| 115 |
- |
|
| 116 |
- info := d.Info(t) |
|
| 117 |
- assert.Equal(t, info.ClusterStore, discoveryStore) |
|
| 118 |
- assert.Equal(t, info.ClusterAdvertise, ip.String()+":2375") |
|
| 119 |
-} |