MCPcopy Create free account
hub / github.com/docker/cli / generateNodes

Function generateNodes

cli/command/service/list_test.go:275–290  ·  view source on GitHub ↗

generateNodes generates a "nodes" endpoint API response with the requested number of "ready" nodes. In addition, a "down" node is generated.

(t *testing.T, activeNodes uint64)

Source from the content-addressed store, hash-verified

273// generateNodes generates a "nodes" endpoint API response with the requested
274// number of "ready" nodes. In addition, a "down" node is generated.
275func generateNodes(t *testing.T, activeNodes uint64) client.NodeListResult {
276 t.Helper()
277 nodes := client.NodeListResult{}
278 var i uint64
279 for i = range activeNodes {
280 nodes.Items = append(nodes.Items, swarm.Node{
281 ID: fmt.Sprintf("node-ready-%d", i),
282 Status: swarm.NodeStatus{State: swarm.NodeStateReady},
283 })
284 nodes.Items = append(nodes.Items, swarm.Node{
285 ID: fmt.Sprintf("node-down-%d", i),
286 Status: swarm.NodeStatus{State: swarm.NodeStateDown},
287 })
288 }
289 return nodes
290}

Callers 1

generateClusterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…