(t *testing.T)
| 400 | } |
| 401 | |
| 402 | func TestCreateMobyContainer(t *testing.T) { |
| 403 | mockCtrl := gomock.NewController(t) |
| 404 | defer mockCtrl.Finish() |
| 405 | apiClient := mocks.NewMockAPIClient(mockCtrl) |
| 406 | cli := mocks.NewMockCli(mockCtrl) |
| 407 | tested, err := NewComposeService(cli) |
| 408 | assert.NilError(t, err) |
| 409 | cli.EXPECT().Client().Return(apiClient).AnyTimes() |
| 410 | cli.EXPECT().ConfigFile().Return(&configfile.ConfigFile{}).AnyTimes() |
| 411 | apiClient.EXPECT().DaemonHost().Return("").AnyTimes() |
| 412 | apiClient.EXPECT().ImageInspect(anyCancellableContext(), gomock.Any()).Return(client.ImageInspectResult{}, nil).AnyTimes() |
| 413 | |
| 414 | apiClient.EXPECT().Ping(gomock.Any(), client.PingOptions{NegotiateAPIVersion: true}).Return(client.PingResult{ |
| 415 | APIVersion: "1.44", |
| 416 | }, nil).AnyTimes() |
| 417 | apiClient.EXPECT().ClientVersion().Return("1.44").AnyTimes() |
| 418 | |
| 419 | service := types.ServiceConfig{ |
| 420 | Name: "test", |
| 421 | Networks: map[string]*types.ServiceNetworkConfig{ |
| 422 | "a": { |
| 423 | Priority: 10, |
| 424 | }, |
| 425 | "b": { |
| 426 | Priority: 100, |
| 427 | }, |
| 428 | }, |
| 429 | } |
| 430 | project := types.Project{ |
| 431 | Name: "bork", |
| 432 | Services: types.Services{ |
| 433 | "test": service, |
| 434 | }, |
| 435 | Networks: types.Networks{ |
| 436 | "a": types.NetworkConfig{ |
| 437 | Name: "a-moby-name", |
| 438 | }, |
| 439 | "b": types.NetworkConfig{ |
| 440 | Name: "b-moby-name", |
| 441 | }, |
| 442 | }, |
| 443 | } |
| 444 | |
| 445 | var got client.ContainerCreateOptions |
| 446 | apiClient.EXPECT().ContainerCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, opts client.ContainerCreateOptions) (client.ContainerCreateResult, error) { |
| 447 | got = opts |
| 448 | return client.ContainerCreateResult{ID: "an-id"}, nil |
| 449 | }) |
| 450 | |
| 451 | apiClient.EXPECT().ContainerInspect(gomock.Any(), gomock.Eq("an-id"), gomock.Any()).Times(1).Return(client.ContainerInspectResult{ |
| 452 | Container: container.InspectResponse{ |
| 453 | ID: "an-id", |
| 454 | Name: "a-name", |
| 455 | Config: &container.Config{}, |
| 456 | NetworkSettings: &container.NetworkSettings{}, |
| 457 | }, |
| 458 | }, nil) |
| 459 |
nothing calls this directly
no test coverage detected