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

Function TestCreateContainerWithProxyConfig

cli/command/container/create_test.go:274–312  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

272}
273
274func TestCreateContainerWithProxyConfig(t *testing.T) {
275 expected := []string{
276 "HTTP_PROXY=httpProxy",
277 "http_proxy=httpProxy",
278 "HTTPS_PROXY=httpsProxy",
279 "https_proxy=httpsProxy",
280 "NO_PROXY=noProxy",
281 "no_proxy=noProxy",
282 "FTP_PROXY=ftpProxy",
283 "ftp_proxy=ftpProxy",
284 "ALL_PROXY=allProxy",
285 "all_proxy=allProxy",
286 }
287 sort.Strings(expected)
288
289 fakeCLI := test.NewFakeCli(&fakeClient{
290 createContainerFunc: func(options client.ContainerCreateOptions) (client.ContainerCreateResult, error) {
291 sort.Strings(options.Config.Env)
292 assert.DeepEqual(t, options.Config.Env, expected)
293 return client.ContainerCreateResult{}, nil
294 },
295 })
296 fakeCLI.SetConfigFile(&configfile.ConfigFile{
297 Proxies: map[string]configfile.ProxyConfig{
298 "default": {
299 HTTPProxy: "httpProxy",
300 HTTPSProxy: "httpsProxy",
301 NoProxy: "noProxy",
302 FTPProxy: "ftpProxy",
303 AllProxy: "allProxy",
304 },
305 },
306 })
307 cmd := newCreateCommand(fakeCLI)
308 cmd.SetOut(io.Discard)
309 cmd.SetArgs([]string{"image:tag"})
310 err := cmd.Execute()
311 assert.NilError(t, err)
312}
313
314type fakeNotFound struct{}
315

Callers

nothing calls this directly

Calls 4

SetConfigFileMethod · 0.95
SetArgsMethod · 0.80
newCreateCommandFunction · 0.70
SetOutMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…