Merge pull request #24050 from ncoolz/issue-cluster-store-config
Fix check code for --cluster-store and --cluster-advertise in config_…
This commit is contained in:
commit
2f9d20288c
2 changed files with 25 additions and 1 deletions
|
@ -123,7 +123,7 @@ func (config *Config) GetAllRuntimes() map[string]types.Runtime {
|
|||
}
|
||||
|
||||
func (config *Config) isSwarmCompatible() error {
|
||||
if config.IsValueSet("cluster-store") || config.IsValueSet("cluster-advertise") {
|
||||
if config.ClusterStore != "" || config.ClusterAdvertise != "" {
|
||||
return fmt.Errorf("--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode")
|
||||
}
|
||||
if config.LiveRestore {
|
||||
|
|
|
@ -4,6 +4,7 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
|
@ -134,3 +135,26 @@ func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) {
|
|||
c.Assert(err, checker.IsNil, check.Commentf("out: %v", out))
|
||||
c.Assert(out, checker.Contains, "Swarm: active")
|
||||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) {
|
||||
// init swarm mode and stop a daemon
|
||||
d := s.AddDaemon(c, true, true)
|
||||
info, err := d.info()
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
|
||||
c.Assert(d.Stop(), checker.IsNil)
|
||||
|
||||
// start a daemon with --cluster-store and --cluster-advertise
|
||||
err = d.Start("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=1.1.1.1:2375")
|
||||
c.Assert(err, checker.NotNil)
|
||||
content, _ := ioutil.ReadFile(d.logFile.Name())
|
||||
c.Assert(string(content), checker.Contains, "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode")
|
||||
|
||||
// start a daemon with --live-restore
|
||||
err = d.Start("--live-restore")
|
||||
c.Assert(err, checker.NotNil)
|
||||
content, _ = ioutil.ReadFile(d.logFile.Name())
|
||||
c.Assert(string(content), checker.Contains, "--live-restore daemon configuration is incompatible with swarm mode")
|
||||
// restart for teardown
|
||||
c.Assert(d.Start(), checker.IsNil)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue