Test for GitHub issue docker/docker#30291
(t *testing.T)
| 212 | |
| 213 | // Test for GitHub issue docker/docker#30291 |
| 214 | func TestContainerListFormatTemplateWithArg(t *testing.T) { |
| 215 | cli := test.NewFakeCli(&fakeClient{ |
| 216 | containerListFunc: func(_ client.ContainerListOptions) (client.ContainerListResult, error) { |
| 217 | return client.ContainerListResult{ |
| 218 | Items: []container.Summary{ |
| 219 | *builders.Container("c1", builders.WithLabel("some.label", "value")), |
| 220 | *builders.Container("c2", builders.WithName("foo/bar"), builders.WithLabel("foo", "bar")), |
| 221 | }, |
| 222 | }, nil |
| 223 | }, |
| 224 | }) |
| 225 | cmd := newListCommand(cli) |
| 226 | cmd.SetArgs([]string{}) |
| 227 | cmd.SetOut(io.Discard) |
| 228 | cmd.SetErr(io.Discard) |
| 229 | assert.Check(t, cmd.Flags().Set("format", `{{.Names}} {{.Label "some.label"}}`)) |
| 230 | assert.NilError(t, cmd.Execute()) |
| 231 | golden.Assert(t, cli.OutBuffer().String(), "container-list-format-with-arg.golden") |
| 232 | } |
| 233 | |
| 234 | func TestContainerListFormatSizeSetsOption(t *testing.T) { |
| 235 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…