MCPcopy
hub / github.com/moby/moby / AddDaemon

Method AddDaemon

integration-cli/check_test.go:589–611  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, joinSwarm, manager bool)

Source from the content-addressed store, hash-verified

587}
588
589func (s *DockerSwarmSuite) AddDaemon(ctx context.Context, t *testing.T, joinSwarm, manager bool) *daemon.Daemon {
590 t.Helper()
591 d := daemon.New(t, dockerBinary, dockerdBinary,
592 testdaemon.WithEnvironment(testEnv.Execution),
593 testdaemon.WithSwarmPort(defaultSwarmPort+s.portIndex),
594 )
595 if joinSwarm {
596 if len(s.daemons) > 0 {
597 d.StartAndSwarmJoin(ctx, t, s.daemons[0].Daemon, manager)
598 } else {
599 d.StartAndSwarmInit(ctx, t)
600 }
601 } else {
602 d.StartNodeWithBusybox(ctx, t)
603 }
604
605 s.daemonsLock.Lock()
606 s.portIndex++
607 s.daemons = append(s.daemons, d)
608 s.daemonsLock.Unlock()
609
610 return d
611}
612
613func (s *DockerSwarmSuite) TearDownTest(ctx context.Context, t *testing.T) {
614 testRequires(t, DaemonIsLinux)

Calls 7

NewFunction · 0.92
StartAndSwarmJoinMethod · 0.80
StartAndSwarmInitMethod · 0.80
StartNodeWithBusyboxMethod · 0.80
UnlockMethod · 0.80
HelperMethod · 0.65
LockMethod · 0.45

Tested by

no test coverage detected