1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add test for swarm error handling

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2017-01-05 15:46:07 -08:00
parent 1b2786c2c2
commit d377b074fd

View file

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