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

Ignore socket rm errors on daemon suite teardown

Errors here are not important and not really related to set success/failure.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2016-08-10 15:18:35 -04:00
parent 19a3289250
commit e34244842c

View file

@ -9,7 +9,6 @@ import (
"testing" "testing"
"github.com/docker/docker/cliconfig" "github.com/docker/docker/cliconfig"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/reexec"
"github.com/docker/engine-api/types/swarm" "github.com/docker/engine-api/types/swarm"
"github.com/go-check/check" "github.com/go-check/check"
@ -189,18 +188,18 @@ func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
} }
func (s *DockerDaemonSuite) TearDownSuite(c *check.C) { func (s *DockerDaemonSuite) TearDownSuite(c *check.C) {
err := filepath.Walk(daemonSockRoot, func(path string, fi os.FileInfo, err error) error { filepath.Walk(daemonSockRoot, func(path string, fi os.FileInfo, err error) error {
if err != nil { if err != nil {
return err // ignore errors here
// not cleaning up sockets is not really an error
return nil
} }
if fi.Mode() == os.ModeSocket { if fi.Mode() == os.ModeSocket {
syscall.Unlink(path) syscall.Unlink(path)
} }
return nil return nil
}) })
c.Assert(err, checker.IsNil, check.Commentf("error while cleaning up daemon sockets")) os.RemoveAll(daemonSockRoot)
err = os.RemoveAll(daemonSockRoot)
c.Assert(err, checker.IsNil, check.Commentf("could not cleanup daemon socket root"))
} }
const defaultSwarmPort = 2477 const defaultSwarmPort = 2477