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

Function TestNodeList

cli/command/node/list_test.go:57–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestNodeList(t *testing.T) {
58 cli := test.NewFakeCli(&fakeClient{
59 nodeListFunc: func() (client.NodeListResult, error) {
60 return client.NodeListResult{
61 Items: []swarm.Node{
62 *builders.Node(builders.NodeID("nodeID1"), builders.Hostname("node-2-foo"), builders.Manager(builders.Leader()), builders.EngineVersion(".")),
63 *builders.Node(builders.NodeID("nodeID2"), builders.Hostname("node-10-foo"), builders.Manager(), builders.EngineVersion("18.03.0-ce")),
64 *builders.Node(builders.NodeID("nodeID3"), builders.Hostname("node-1-foo")),
65 },
66 }, nil
67 },
68 infoFunc: func() (client.SystemInfoResult, error) {
69 return client.SystemInfoResult{
70 Info: system.Info{
71 Swarm: swarm.Info{NodeID: "nodeID1"},
72 },
73 }, nil
74 },
75 })
76
77 cmd := newListCommand(cli)
78 assert.NilError(t, cmd.Execute())
79 golden.Assert(t, cli.OutBuffer().String(), "node-list-sort.golden")
80}
81
82func TestNodeListQuietShouldOnlyPrintIDs(t *testing.T) {
83 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 6

OutBufferMethod · 0.95
NodeMethod · 0.80
newListCommandFunction · 0.70
StringMethod · 0.65
HostnameMethod · 0.45
EngineVersionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…