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

Integration-cli: change daemon id generation

Fixes #24805

Changes test daemon id generation from using time.Now().UnixNano() to using
stringid. This is because of a go bug (fixed upstream for 1.8) on ppc64le
and s390x where time.Now().UnixNano() would not return nanosecond precision,
so initializing consecutive daemons sometimes would result in them having
the same id.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
This commit is contained in:
Christopher Jones 2016-09-06 18:08:14 -04:00
parent 75c36bcc64
commit 42f3865d24
No known key found for this signature in database
GPG key ID: 9675B4D446658DE9

View file

@ -17,6 +17,7 @@ import (
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/engine-api/types/events"
"github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig"
@ -61,7 +62,7 @@ func NewDaemon(c *check.C) *Daemon {
err := os.MkdirAll(daemonSockRoot, 0700)
c.Assert(err, checker.IsNil, check.Commentf("could not create daemon socket root"))
id := fmt.Sprintf("d%d", time.Now().UnixNano()%100000000)
id := fmt.Sprintf("d%s", stringid.TruncateID(stringid.GenerateRandomID()))
dir := filepath.Join(dest, id)
daemonFolder, err := filepath.Abs(dir)
c.Assert(err, check.IsNil, check.Commentf("Could not make %q an absolute path", dir))