Przeglądaj źródła

Add integration tests for swarm incompatible

Signed-off-by: Wonjun Kim <wonjun.kim@navercorp.com>
Wonjun Kim 9 lat temu
rodzic
commit
d71789828f
1 zmienionych plików z 24 dodań i 0 usunięć
  1. 24 0
      integration-cli/docker_cli_swarm_test.go

+ 24 - 0
integration-cli/docker_cli_swarm_test.go

@@ -4,6 +4,7 @@ package main
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
+	"io/ioutil"
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/pkg/integration/checker"
 	"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(err, checker.IsNil, check.Commentf("out: %v", out))
 	c.Assert(out, checker.Contains, "Swarm: active")
 	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)
+}