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

Function TestTaskPrintWithResolution

cli/command/task/print_test.go:165–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func TestTaskPrintWithResolution(t *testing.T) {
166 const quiet = false
167 const trunc = false
168 const noResolve = false
169 apiClient := &fakeClient{
170 serviceInspectFunc: func(ref string, options client.ServiceInspectOptions) (client.ServiceInspectResult, error) {
171 return client.ServiceInspectResult{
172 Service: *builders.Service(builders.ServiceName("service-name-foo")),
173 }, nil
174 },
175 nodeInspectFunc: func(ref string) (client.NodeInspectResult, error) {
176 return client.NodeInspectResult{
177 Node: *builders.Node(builders.NodeName("node-name-bar")),
178 }, nil
179 },
180 }
181 cli := test.NewFakeCli(apiClient)
182 tasks := client.TaskListResult{
183 Items: []swarm.Task{
184 *builders.Task(builders.TaskServiceID("service-id-foo"), builders.TaskSlot(1)),
185 },
186 }
187 err := Print(context.Background(), cli, tasks, idresolver.New(apiClient, noResolve), trunc, quiet, "{{ .Name }} {{ .Node }}")
188 assert.NilError(t, err)
189 golden.Assert(t, cli.OutBuffer().String(), "task-print-with-resolution.golden")
190}

Callers

nothing calls this directly

Calls 4

OutBufferMethod · 0.95
PrintFunction · 0.85
NodeMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…