daemon_swarm_hack.go 534 B

1234567891011121314151617181920
  1. package main
  2. import "github.com/go-check/check"
  3. func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *SwarmDaemon {
  4. s.daemonsLock.Lock()
  5. defer s.daemonsLock.Unlock()
  6. for _, d := range s.daemons {
  7. if d.NodeID == nodeID {
  8. return d
  9. }
  10. }
  11. c.Fatalf("could not find node with id: %s", nodeID)
  12. return nil
  13. }
  14. // nodeCmd executes a command on a given node via the normal docker socket
  15. func (s *DockerSwarmSuite) nodeCmd(c *check.C, id string, args ...string) (string, error) {
  16. return s.getDaemon(c, id).Cmd(args...)
  17. }