Add integration tests for swarm incompatible

Signed-off-by: Wonjun Kim <wonjun.kim@navercorp.com>
(cherry picked from commit d71789828f)
This commit is contained in:
Wonjun Kim 2016-06-29 06:20:52 +09:00 committed by Tibor Vass
parent bd572fcd8f
commit 9ce196dc3c

View file

@ -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)
}