| 71 | } |
| 72 | |
| 73 | func TestRunPSWarnsOnNotFound(t *testing.T) { |
| 74 | apiClient := &fakeClient{ |
| 75 | serviceListFunc: func(ctx context.Context, options client.ServiceListOptions) (client.ServiceListResult, error) { |
| 76 | return client.ServiceListResult{ |
| 77 | Items: []swarm.Service{{ID: "foo"}}, |
| 78 | }, nil |
| 79 | }, |
| 80 | } |
| 81 | |
| 82 | cli := test.NewFakeCli(apiClient) |
| 83 | options := psOptions{ |
| 84 | services: []string{"foo", "bar"}, |
| 85 | filter: opts.NewFilterOpt(), |
| 86 | format: "{{.ID}}", |
| 87 | } |
| 88 | |
| 89 | ctx := context.Background() |
| 90 | err := runPS(ctx, cli, options) |
| 91 | assert.Error(t, err, "no such service: bar") |
| 92 | } |
| 93 | |
| 94 | func TestRunPSQuiet(t *testing.T) { |
| 95 | apiClient := &fakeClient{ |