MCPcopy Index your code
hub / github.com/docker/cli / TestSwarmJoinToken

Function TestSwarmJoinToken

cli/command/swarm/join_token_test.go:111–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestSwarmJoinToken(t *testing.T) {
112 testCases := []struct {
113 name string
114 args []string
115 flags map[string]string
116 infoFunc func() (system.Info, error)
117 swarmInspectFunc func() (client.SwarmInspectResult, error)
118 nodeInspectFunc func() (client.NodeInspectResult, error)
119 }{
120 {
121 name: "worker",
122 args: []string{"worker"},
123 infoFunc: func() (system.Info, error) {
124 return system.Info{
125 Swarm: swarm.Info{
126 NodeID: "nodeID",
127 },
128 }, nil
129 },
130 nodeInspectFunc: func() (client.NodeInspectResult, error) {
131 return client.NodeInspectResult{
132 Node: *builders.Node(builders.Manager()),
133 }, nil
134 },
135 swarmInspectFunc: func() (client.SwarmInspectResult, error) {
136 return client.SwarmInspectResult{
137 Swarm: *builders.Swarm(),
138 }, nil
139 },
140 },
141 {
142 name: "manager",
143 args: []string{"manager"},
144 infoFunc: func() (system.Info, error) {
145 return system.Info{
146 Swarm: swarm.Info{
147 NodeID: "nodeID",
148 },
149 }, nil
150 },
151 nodeInspectFunc: func() (client.NodeInspectResult, error) {
152 return client.NodeInspectResult{
153 Node: *builders.Node(builders.Manager()),
154 }, nil
155 },
156 swarmInspectFunc: func() (client.SwarmInspectResult, error) {
157 return client.SwarmInspectResult{
158 Swarm: *builders.Swarm(),
159 }, nil
160 },
161 },
162 {
163 name: "manager-rotate",
164 args: []string{"manager"},
165 flags: map[string]string{
166 flagRotate: "true",
167 },
168 infoFunc: func() (system.Info, error) {

Callers

nothing calls this directly

Calls 6

OutBufferMethod · 0.95
newJoinTokenCommandFunction · 0.85
NodeMethod · 0.80
SetArgsMethod · 0.80
StringMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…