gopkg.in/docker/docker.v20@v20.10.27/integration-cli/daemon_swarm_hack_test.go (about)

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