1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration(-cli): remove discovery related tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-12-15 18:58:06 +01:00
parent 702cb7fe14
commit 65b92a730a
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 2 additions and 145 deletions

View file

@ -840,22 +840,6 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainer
s.d.Restart(c)
}
func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *testing.T) {
// Start daemon without docker0 bridge
defaultNetworkBridge := "docker0"
deleteInterface(c, defaultNetworkBridge)
discoveryBackend := "consul://consuladdr:consulport/some/path"
s.d.Start(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
// Start daemon with docker0 bridge
result := icmd.RunCommand("ifconfig", defaultNetworkBridge)
result.Assert(c, icmd.Success)
s.d.Restart(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
}
func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
d := s.d
@ -2229,51 +2213,6 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *testing.T) {
assert.Assert(c, strings.Contains(b.String(), debugLog))
}
func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) {
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
// daemon config file
daemonConfig := `{ "debug" : false }`
configFile, err := os.CreateTemp("", "test-daemon-discovery-backend-config-reload-config")
assert.Assert(c, err == nil, "could not create temp file for config reload")
configFilePath := configFile.Name()
defer func() {
configFile.Close()
os.RemoveAll(configFile.Name())
}()
_, err = configFile.Write([]byte(daemonConfig))
assert.NilError(c, err)
// --log-level needs to be set so that d.Start() doesn't add --debug causing
// a conflict with the config
s.d.Start(c, "--config-file", configFilePath, "--log-level=info")
// daemon config file
daemonConfig = `{
"cluster-store": "consul://consuladdr:consulport/some/path",
"cluster-advertise": "192.168.56.100:0",
"debug" : false
}`
err = configFile.Truncate(0)
assert.NilError(c, err)
_, err = configFile.Seek(0, io.SeekStart)
assert.NilError(c, err)
_, err = configFile.Write([]byte(daemonConfig))
assert.NilError(c, err)
err = s.d.ReloadConfig()
assert.Assert(c, err == nil, "error reloading daemon config")
out, err := s.d.Cmd("info")
assert.NilError(c, err)
assert.Assert(c, strings.Contains(out, "Cluster Store: consul://consuladdr:consulport/some/path"))
assert.Assert(c, strings.Contains(out, "Cluster Advertise: 192.168.56.100:0"))
}
// Test for #21956
func (s *DockerDaemonSuite) TestDaemonLogOptions(c *testing.T) {
s.d.StartWithBusybox(c, "--log-driver=syslog", "--log-opt=syslog-address=udp://127.0.0.1:514")

View file

@ -415,9 +415,6 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
expectedSubstrings := []string{
" daemon reload " + info.ID + " ",
"(allow-nondistributable-artifacts=[",
" cluster-advertise=, ",
" cluster-store=, ",
" cluster-store-opts=",
" debug=true, ",
" default-ipc-mode=",
" default-runtime=",

View file

@ -152,17 +152,11 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
d.Stop(c)
// start a daemon with --cluster-store and --cluster-advertise
err := d.StartWithError("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=1.1.1.1:2375")
// start a daemon with --live-restore
err := d.StartWithError("--live-restore")
assert.ErrorContains(c, err, "")
content, err := d.ReadLogFile()
assert.NilError(c, err)
assert.Assert(c, strings.Contains(string(content), "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode"))
// start a daemon with --live-restore
err = d.StartWithError("--live-restore")
assert.ErrorContains(c, err, "")
content, err = d.ReadLogFile()
assert.NilError(c, err)
assert.Assert(c, strings.Contains(string(content), "--live-restore daemon configuration is incompatible with swarm mode"))
// restart for teardown
d.StartNode(c)

View file

@ -5,16 +5,12 @@ package system // import "github.com/docker/docker/integration/system"
import (
"context"
"fmt"
"net"
"net/http"
"testing"
"github.com/docker/docker/testutil/daemon"
req "github.com/docker/docker/testutil/request"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/skip"
)
func TestInfoBinaryCommits(t *testing.T) {
@ -48,72 +44,3 @@ func TestInfoAPIVersioned(t *testing.T) {
assert.Check(t, is.Contains(out, "ExecutionDriver"))
assert.Check(t, is.Contains(out, "not supported"))
}
// TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
// `--cluster-store` properly returns the backend's endpoint in info output.
func TestInfoDiscoveryBackend(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
const (
discoveryBackend = "consul://consuladdr:consulport/some/path"
discoveryAdvertise = "1.1.1.1:2375"
)
d := daemon.New(t)
d.Start(t, "--cluster-store="+discoveryBackend, "--cluster-advertise="+discoveryAdvertise)
defer d.Stop(t)
info := d.Info(t)
assert.Equal(t, info.ClusterStore, discoveryBackend)
assert.Equal(t, info.ClusterAdvertise, discoveryAdvertise)
}
// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with
// an invalid `--cluster-advertise` configuration
func TestInfoDiscoveryInvalidAdvertise(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
d := daemon.New(t)
// --cluster-advertise with an invalid string is an error
err := d.StartWithError("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=invalid")
if err == nil {
d.Stop(t)
}
assert.ErrorContains(t, err, "", "expected error when starting daemon")
// --cluster-advertise without --cluster-store is also an error
err = d.StartWithError("--cluster-advertise=1.1.1.1:2375")
if err == nil {
d.Stop(t)
}
assert.ErrorContains(t, err, "", "expected error when starting daemon")
}
// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
// configured with interface name properly show the advertise ip-address in info output.
func TestInfoDiscoveryAdvertiseInterfaceName(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
skip.If(t, testEnv.IsRootless, "rootless mode has different view of network")
// TODO should we check for networking availability (integration-cli suite checks for networking through `Network()`)
d := daemon.New(t)
const (
discoveryStore = "consul://consuladdr:consulport/some/path"
discoveryInterface = "eth0"
)
d.Start(t, "--cluster-store="+discoveryStore, fmt.Sprintf("--cluster-advertise=%s:2375", discoveryInterface))
defer d.Stop(t)
iface, err := net.InterfaceByName(discoveryInterface)
assert.NilError(t, err)
addrs, err := iface.Addrs()
assert.NilError(t, err)
assert.Assert(t, len(addrs) > 0)
ip, _, err := net.ParseCIDR(addrs[0].String())
assert.NilError(t, err)
info := d.Info(t)
assert.Equal(t, info.ClusterStore, discoveryStore)
assert.Equal(t, info.ClusterAdvertise, ip.String()+":2375")
}