Files
moby/integration-cli/daemon_swarm_hack_test.go
Derek McGowan f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07:00

25 lines
580 B
Go

package main
import (
"testing"
"github.com/moby/moby/v2/integration-cli/daemon"
)
func (s *DockerSwarmSuite) getDaemon(t *testing.T, nodeID string) *daemon.Daemon {
s.daemonsLock.Lock()
defer s.daemonsLock.Unlock()
for _, d := range s.daemons {
if d.NodeID() == nodeID {
return d
}
}
t.Fatalf("could not find node with id: %s", nodeID)
return nil
}
// nodeCmd executes a command on a given node via the normal docker socket
func (s *DockerSwarmSuite) nodeCmd(t *testing.T, id string, args ...string) (string, error) {
return s.getDaemon(t, id).Cmd(args...)
}