1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/daemon_swarm_hack_test.go
Vincent Demeester 9af5d7c340
Small cleanups on integration cli
- Join a few tests in one when it makes sense (reduce the number of
  container run and thus the overall time of the suites)
- Remove some duplication on several tests
- Remove some unused methods

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-12 16:57:59 +01:00

23 lines
591 B
Go

package main
import (
"github.com/docker/docker/integration-cli/daemon"
"github.com/go-check/check"
)
func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *daemon.Swarm {
s.daemonsLock.Lock()
defer s.daemonsLock.Unlock()
for _, d := range s.daemons {
if d.NodeID == nodeID {
return d
}
}
c.Fatalf("could not find node with id: %s", nodeID)
return nil
}
// nodeCmd executes a command on a given node via the normal docker socket
func (s *DockerSwarmSuite) nodeCmd(c *check.C, id string, args ...string) (string, error) {
return s.getDaemon(c, id).Cmd(args...)
}