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

Function TestContainerListWithConfigFormat

cli/command/container/list_test.go:289–309  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

287}
288
289func TestContainerListWithConfigFormat(t *testing.T) {
290 cli := test.NewFakeCli(&fakeClient{
291 containerListFunc: func(_ client.ContainerListOptions) (client.ContainerListResult, error) {
292 return client.ContainerListResult{
293 Items: []container.Summary{
294 *builders.Container("c1", builders.WithLabel("some.label", "value"), builders.WithSize(10700000)),
295 *builders.Container("c2", builders.WithName("foo/bar"), builders.WithLabel("foo", "bar"), builders.WithSize(3200000)),
296 },
297 }, nil
298 },
299 })
300 cli.SetConfigFile(&configfile.ConfigFile{
301 PsFormat: "{{ .Names }} {{ .Image }} {{ .Labels }} {{ .Size}}",
302 })
303 cmd := newListCommand(cli)
304 cmd.SetArgs([]string{})
305 cmd.SetOut(io.Discard)
306 cmd.SetErr(io.Discard)
307 assert.NilError(t, cmd.Execute())
308 golden.Assert(t, cli.OutBuffer().String(), "container-list-with-config-format.golden")
309}
310
311func TestContainerListWithFormat(t *testing.T) {
312 cli := test.NewFakeCli(&fakeClient{

Callers

nothing calls this directly

Calls 8

SetConfigFileMethod · 0.95
OutBufferMethod · 0.95
ContainerMethod · 0.80
SetArgsMethod · 0.80
newListCommandFunction · 0.70
StringMethod · 0.65
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…