daemon_swarm_hack_test.go 581 B

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