MCPcopy Create free account
hub / github.com/docker/cli / TestServiceListOrder

Function TestServiceListOrder

cli/command/service/list_test.go:19–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestServiceListOrder(t *testing.T) {
20 cli := test.NewFakeCli(&fakeClient{
21 serviceListFunc: func(ctx context.Context, options client.ServiceListOptions) (client.ServiceListResult, error) {
22 return client.ServiceListResult{
23 Items: []swarm.Service{
24 newService("a57dbe8", "service-1-foo"),
25 newService("a57dbdd", "service-10-foo"),
26 newService("aaaaaaa", "service-2-foo"),
27 },
28 }, nil
29 },
30 })
31 cmd := newListCommand(cli)
32 cmd.SetArgs([]string{})
33 assert.Check(t, cmd.Flags().Set("format", "{{.Name}}"))
34 assert.NilError(t, cmd.Execute())
35 golden.Assert(t, cli.OutBuffer().String(), "service-list-sort.golden")
36}
37
38// TestServiceListServiceStatus tests that the ServiceStatus struct is correctly
39// propagated. For older API versions, the ServiceStatus is calculated locally,

Callers

nothing calls this directly

Calls 6

OutBufferMethod · 0.95
newServiceFunction · 0.85
SetArgsMethod · 0.80
newListCommandFunction · 0.70
StringMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…