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

Function TestStackPs

cli/command/stack/ps_test.go:55–206  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestStackPs(t *testing.T) {
56 testCases := []struct {
57 doc string
58 taskListFunc func(client.TaskListOptions) (client.TaskListResult, error)
59 nodeInspectFunc func(ref string) (client.NodeInspectResult, error)
60 config configfile.ConfigFile
61 args []string
62 flags map[string]string
63 expectedErr string
64 golden string
65 }{
66 {
67 doc: "WithEmptyName",
68 args: []string{"' '"},
69 expectedErr: `invalid stack name: "' '"`,
70 },
71 {
72 doc: "WithEmptyStack",
73 taskListFunc: func(options client.TaskListOptions) (client.TaskListResult, error) {
74 return client.TaskListResult{}, nil
75 },
76 args: []string{"foo"},
77 expectedErr: "nothing found in stack: foo",
78 },
79 {
80 doc: "WithQuietOption",
81 taskListFunc: func(options client.TaskListOptions) (client.TaskListResult, error) {
82 return client.TaskListResult{
83 Items: []swarm.Task{
84 *builders.Task(builders.TaskID("id-foo")),
85 },
86 }, nil
87 },
88 args: []string{"foo"},
89 flags: map[string]string{
90 "quiet": "true",
91 },
92 golden: "stack-ps-with-quiet-option.golden",
93 },
94 {
95 doc: "WithNoTruncOption",
96 taskListFunc: func(options client.TaskListOptions) (client.TaskListResult, error) {
97 return client.TaskListResult{
98 Items: []swarm.Task{
99 *builders.Task(builders.TaskID("xn4cypcov06f2w8gsbaf2lst3")),
100 },
101 }, nil
102 },
103 args: []string{"foo"},
104 flags: map[string]string{
105 "no-trunc": "true",
106 "format": "{{ .ID }}",
107 },
108 golden: "stack-ps-with-no-trunc-option.golden",
109 },
110 {
111 doc: "WithNoResolveOption",
112 taskListFunc: func(options client.TaskListOptions) (client.TaskListResult, error) {

Callers

nothing calls this directly

Calls 10

SetConfigFileMethod · 0.95
OutBufferMethod · 0.95
NodeMethod · 0.80
SetArgsMethod · 0.80
newPsCommandFunction · 0.70
StringMethod · 0.65
SetMethod · 0.45
SetOutMethod · 0.45
SetErrMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…