moby: Can't run swarm tests in Docker for Mac

I tried to run DockerSwarmSuite.TestApiSwarmPromoteDemote using Docker for Mac as the container runtime.

The test fails with this output:

FAIL: docker_api_swarm_test.go:161: DockerSwarmSuite.TestApiSwarmPromoteDemote

[d56553497] waiting for daemon to start
docker_api_swarm_test.go:162:
[d56553497] exiting daemon
    d1 := s.AddDaemon(c, false, false)
check_test.go:212:
    c.Assert(err, check.IsNil)
... value *errors.errorString = &errors.errorString{s:"[d56553497] Daemon exited during startup"} ("[d56553497] Daemon exited during startup")

OOPS: 0 passed, 1 FAILED
--- FAIL: Test (0.38s)
FAIL
coverage: 12.9% of statements

Inspecting the test logs, I found an error binding to a unix socket when starting a daemon:

time="2016-06-14T21:00:02.103033648Z" level=fatal msg="can't create unix socket /go/src/github.com/docker/docker/bundles/1.12.0-dev/test-integration-cli/d86922137/docker.sock: listen unix /go/src/github.com/docker/docker/bundles/1.12.0-dev/test-integration-cli/d86922137/docker.sock: bind: file name too long"

The filename length limit for a unix socket should be 108 characters, but this path is only 95 characters, so I am puzzled why bind is failing.

I seem to have the same problem with all other tests in DockerSwarmSuite.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 1
  • Comments: 22 (22 by maintainers)

Commits related to this issue

Most upvoted comments

There are issues with socket name lengths if the socket is being created on a volume shared with the Mac, as the path being created will be the full un-namespaced socket path and will also include the OSX directory path you are sharing, and the OSX length is shorter than the Linux one. This also happens with running the docker/docker tests, unless you run them inside a container. We do have an outstanding issue for it, but it will probably have to be a really hacky workaround (eg remapping paths to something else) and it will probably not happen for a while. These socket name lengths are a relic of an older more innocent age when filesystem path lengths were smaller, but are stuck in the ABI. I might try to change the tests to use sockets in /tmp or something as a workaround…