github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/integration-cli/daemon_swarm_hack_test.go (about) 1 package main 2 3 import ( 4 "github.com/docker/docker/integration-cli/daemon" 5 "github.com/go-check/check" 6 ) 7 8 func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *daemon.Daemon { 9 s.daemonsLock.Lock() 10 defer s.daemonsLock.Unlock() 11 for _, d := range s.daemons { 12 if d.NodeID() == nodeID { 13 return d 14 } 15 } 16 c.Fatalf("could not find node with id: %s", nodeID) 17 return nil 18 } 19 20 // nodeCmd executes a command on a given node via the normal docker socket 21 func (s *DockerSwarmSuite) nodeCmd(c *check.C, id string, args ...string) (string, error) { 22 return s.getDaemon(c, id).Cmd(args...) 23 }