(t *testing.T)
| 51 | } |
| 52 | |
| 53 | func 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 | |
| 72 | func TestNodeDemoteMultipleNode(t *testing.T) { |
| 73 | cmd := newDemoteCommand( |
nothing calls this directly
no test coverage detected
searching dependent graphs…