| 92 | } |
| 93 | |
| 94 | func TestRunPSQuiet(t *testing.T) { |
| 95 | apiClient := &fakeClient{ |
| 96 | serviceListFunc: func(ctx context.Context, options client.ServiceListOptions) (client.ServiceListResult, error) { |
| 97 | return client.ServiceListResult{ |
| 98 | Items: []swarm.Service{{ID: "foo"}}, |
| 99 | }, nil |
| 100 | }, |
| 101 | taskListFunc: func(ctx context.Context, options client.TaskListOptions) (client.TaskListResult, error) { |
| 102 | return client.TaskListResult{ |
| 103 | Items: []swarm.Task{{ID: "sxabyp0obqokwekpun4rjo0b3"}}, |
| 104 | }, nil |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | cli := test.NewFakeCli(apiClient) |
| 109 | ctx := context.Background() |
| 110 | err := runPS(ctx, cli, psOptions{services: []string{"foo"}, quiet: true, filter: opts.NewFilterOpt()}) |
| 111 | assert.NilError(t, err) |
| 112 | assert.Check(t, is.Equal("sxabyp0obqokwekpun4rjo0b3\n", cli.OutBuffer().String())) |
| 113 | } |
| 114 | |
| 115 | func TestUpdateNodeFilter(t *testing.T) { |
| 116 | selfNodeID := "foofoo" |