github.com/morganxf/moby@v1.13.1/integration-cli/daemon_swarm_hack.go (about)

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