MCPcopy Create free account
hub / github.com/docker/cli / TestParseRunAttach

Function TestParseRunAttach

cli/command/container/opts_test.go:157–207  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestParseRunAttach(t *testing.T) {
158 tests := []struct {
159 input string
160 expected container.Config
161 }{
162 {
163 input: "",
164 expected: container.Config{
165 AttachStdout: true,
166 AttachStderr: true,
167 },
168 },
169 {
170 input: "-i",
171 expected: container.Config{
172 AttachStdin: true,
173 AttachStdout: true,
174 AttachStderr: true,
175 },
176 },
177 {
178 input: "-a stdin",
179 expected: container.Config{
180 AttachStdin: true,
181 },
182 },
183 {
184 input: "-a stdin -a stdout",
185 expected: container.Config{
186 AttachStdin: true,
187 AttachStdout: true,
188 },
189 },
190 {
191 input: "-a stdin -a stdout -a stderr",
192 expected: container.Config{
193 AttachStdin: true,
194 AttachStdout: true,
195 AttachStderr: true,
196 },
197 },
198 }
199 for _, tc := range tests {
200 t.Run(tc.input, func(t *testing.T) {
201 config, _, _ := mustParse(t, tc.input)
202 assert.Equal(t, config.AttachStdin, tc.expected.AttachStdin)
203 assert.Equal(t, config.AttachStdout, tc.expected.AttachStdout)
204 assert.Equal(t, config.AttachStderr, tc.expected.AttachStderr)
205 })
206 }
207}
208
209func TestParseRunWithInvalidArgs(t *testing.T) {
210 tests := []struct {

Callers

nothing calls this directly

Calls 1

mustParseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…