Browse code

Add test for swarm error handling

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2017/01/06 08:46:07
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ package main
4 4
 
5 5
 import (
6 6
 	"fmt"
7
+	"net"
7 8
 	"net/http"
8 9
 	"os"
9 10
 	"path/filepath"
... ...
@@ -1317,3 +1318,14 @@ func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *check.C) {
1317 1317
 	c.Assert(err, checker.NotNil)
1318 1318
 	c.Assert(err.Error(), checker.Contains, "swarm is not locked")
1319 1319
 }
1320
+
1321
+// #29885
1322
+func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) {
1323
+	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultSwarmPort))
1324
+	c.Assert(err, checker.IsNil)
1325
+	defer ln.Close()
1326
+	d := s.AddDaemon(c, false, false)
1327
+	err = d.Init(swarm.InitRequest{})
1328
+	c.Assert(err, checker.NotNil)
1329
+	c.Assert(err.Error(), checker.Contains, "address already in use")
1330
+}