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

Function TestNodeDemoteNoChange

cli/command/node/demote_test.go:53–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestNodeDemoteNoChange(t *testing.T) {
54 cmd := newDemoteCommand(
55 test.NewFakeCli(&fakeClient{
56 nodeInspectFunc: func() (client.NodeInspectResult, error) {
57 return client.NodeInspectResult{
58 Node: *builders.Node(),
59 }, nil
60 },
61 nodeUpdateFunc: func(nodeID string, options client.NodeUpdateOptions) (client.NodeUpdateResult, error) {
62 if options.Spec.Role != swarm.NodeRoleWorker {
63 return client.NodeUpdateResult{}, errors.New("expected role worker, got " + string(options.Spec.Role))
64 }
65 return client.NodeUpdateResult{}, nil
66 },
67 }))
68 cmd.SetArgs([]string{"nodeID"})
69 assert.NilError(t, cmd.Execute())
70}
71
72func TestNodeDemoteMultipleNode(t *testing.T) {
73 cmd := newDemoteCommand(

Callers

nothing calls this directly

Calls 3

newDemoteCommandFunction · 0.85
NodeMethod · 0.80
SetArgsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…