Browse Source

Add test for swarm error handling

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 8 years ago
parent
commit
d377b074fd
1 changed files with 12 additions and 0 deletions
  1. 12 0
      integration-cli/docker_api_swarm_test.go

+ 12 - 0
integration-cli/docker_api_swarm_test.go

@@ -4,6 +4,7 @@ package main
 
 import (
 	"fmt"
+	"net"
 	"net/http"
 	"os"
 	"path/filepath"
@@ -1317,3 +1318,14 @@ func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *check.C) {
 	c.Assert(err, checker.NotNil)
 	c.Assert(err.Error(), checker.Contains, "swarm is not locked")
 }
+
+// #29885
+func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) {
+	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultSwarmPort))
+	c.Assert(err, checker.IsNil)
+	defer ln.Close()
+	d := s.AddDaemon(c, false, false)
+	err = d.Init(swarm.InitRequest{})
+	c.Assert(err, checker.NotNil)
+	c.Assert(err.Error(), checker.Contains, "address already in use")
+}