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

Function TestParseExec

cli/command/container/exec_test.go:30–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestParseExec(t *testing.T) {
31 content := `ONE=1
32TWO=2
33 `
34
35 tmpFile := fs.NewFile(t, t.Name(), fs.WithContent(content))
36 defer tmpFile.Remove()
37
38 testcases := []struct {
39 options ExecOptions
40 configFile configfile.ConfigFile
41 expected client.ExecCreateOptions
42 }{
43 {
44 expected: client.ExecCreateOptions{
45 Cmd: []string{"command"},
46 AttachStdout: true,
47 AttachStderr: true,
48 },
49 options: withDefaultOpts(ExecOptions{}),
50 },
51 {
52 expected: client.ExecCreateOptions{
53 Cmd: []string{"command1", "command2"},
54 AttachStdout: true,
55 AttachStderr: true,
56 },
57 options: withDefaultOpts(ExecOptions{
58 Command: []string{"command1", "command2"},
59 }),
60 },
61 {
62 options: withDefaultOpts(ExecOptions{
63 Interactive: true,
64 TTY: true,
65 User: "uid",
66 }),
67 expected: client.ExecCreateOptions{
68 User: "uid",
69 AttachStdin: true,
70 AttachStdout: true,
71 AttachStderr: true,
72 TTY: true,
73 Cmd: []string{"command"},
74 },
75 },
76 {
77 options: withDefaultOpts(ExecOptions{Detach: true}),
78 expected: client.ExecCreateOptions{
79 Cmd: []string{"command"},
80 },
81 },
82 {
83 options: withDefaultOpts(ExecOptions{
84 TTY: true,
85 Interactive: true,
86 Detach: true,
87 }),

Callers

nothing calls this directly

Calls 6

withDefaultOptsFunction · 0.85
parseExecFunction · 0.85
RemoveMethod · 0.65
PathMethod · 0.65
NameMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…