(t *testing.T)
| 272 | } |
| 273 | |
| 274 | func 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 | |
| 314 | type fakeNotFound struct{} |
| 315 |
nothing calls this directly
no test coverage detected
searching dependent graphs…