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

Function TestStartValidateFlags

cli/command/container/start_test.go:12–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestStartValidateFlags(t *testing.T) {
13 for _, tc := range []struct {
14 name string
15 args []string
16 expectedErr string
17 }{
18 {
19 name: "with invalid --detach-keys",
20 args: []string{"--detach-keys", "shift-a", "myimage"},
21 expectedErr: "invalid detach keys (shift-a):",
22 },
23 } {
24 t.Run(tc.name, func(t *testing.T) {
25 cmd := newStartCommand(test.NewFakeCli(&fakeClient{}))
26 cmd.SetOut(io.Discard)
27 cmd.SetErr(io.Discard)
28 cmd.SetArgs(tc.args)
29
30 err := cmd.Execute()
31 if tc.expectedErr != "" {
32 assert.Check(t, is.ErrorContains(err, tc.expectedErr))
33 } else {
34 assert.Check(t, is.Nil(err))
35 }
36 })
37 }
38}

Callers

nothing calls this directly

Calls 4

newStartCommandFunction · 0.85
SetArgsMethod · 0.80
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…