Skip to content

Commit

Permalink
Better logging for swarm tests
Browse files Browse the repository at this point in the history
Call helper for starting swarm agents and add some logging with daemon
id's when joining the swarm.

Signed-off-by: Brian Goff <[email protected]>
  • Loading branch information
cpuguy83 committed Jul 24, 2019
1 parent a9dc697 commit b0fe0df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/test/daemon/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ func (d *Daemon) StartAndSwarmInit(t testingT) {

// StartAndSwarmJoin starts the daemon (with busybox) and join the specified swarm as worker or manager
func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool) {
if th, ok := t.(test.HelperT); ok {
th.Helper()
}
d.StartNode(t)

tokens := leader.JoinTokens(t)
token := tokens.Worker
if manager {
token = tokens.Manager
}
t.Logf("[%s] joining swarm manager [%s]@%s, swarm listen addr %s", d.id, leader.id, leader.SwarmListenAddr(), d.SwarmListenAddr())
d.SwarmJoin(t, swarm.JoinRequest{
RemoteAddrs: []string{leader.SwarmListenAddr()},
JoinToken: token,
Expand Down Expand Up @@ -106,7 +110,7 @@ func (d *Daemon) SwarmJoin(t assert.TestingT, req swarm.JoinRequest) {
cli := d.NewClientT(t)
defer cli.Close()
err := cli.SwarmJoin(context.Background(), req)
assert.NilError(t, err, "initializing swarm")
assert.NilError(t, err, "[%s] joining swarm", d.id)
d.CachedInfo = d.Info(t)
}

Expand Down

0 comments on commit b0fe0df

Please sign in to comment.