(t *testing.T)
| 505 | } |
| 506 | |
| 507 | func TestComposeUpWithScale(t *testing.T) { |
| 508 | testCase := nerdtest.Setup() |
| 509 | |
| 510 | testCase.Setup = func(data test.Data, helpers test.Helpers) { |
| 511 | var composeYAML = fmt.Sprintf(` |
| 512 | services: |
| 513 | test: |
| 514 | image: %s |
| 515 | command: "sleep infinity" |
| 516 | `, testutil.CommonImage) |
| 517 | |
| 518 | composePath := data.Temp().Save(composeYAML, "compose.yaml") |
| 519 | |
| 520 | projectName := filepath.Base(filepath.Dir(composePath)) |
| 521 | t.Logf("projectName=%q", projectName) |
| 522 | |
| 523 | test1 := serviceparser.DefaultContainerName(projectName, "test", "1") |
| 524 | test2 := serviceparser.DefaultContainerName(projectName, "test", "2") |
| 525 | |
| 526 | data.Labels().Set("composeYAML", composePath) |
| 527 | data.Labels().Set("test1", test1) |
| 528 | data.Labels().Set("test2", test2) |
| 529 | |
| 530 | helpers.Ensure("compose", "-f", composePath, "up", "-d", "--scale", "test=2") |
| 531 | nerdtest.EnsureContainerStarted(helpers, test1) |
| 532 | nerdtest.EnsureContainerStarted(helpers, test2) |
| 533 | } |
| 534 | |
| 535 | testCase.Command = func(data test.Data, helpers test.Helpers) test.TestableCommand { |
| 536 | return helpers.Command("compose", "-f", data.Labels().Get("composeYAML"), "ps") |
| 537 | } |
| 538 | |
| 539 | testCase.Expected = func(data test.Data, helpers test.Helpers) *test.Expected { |
| 540 | return &test.Expected{ |
| 541 | ExitCode: 0, |
| 542 | Output: expect.All( |
| 543 | expect.Contains(data.Labels().Get("test1")), |
| 544 | expect.Contains(data.Labels().Get("test2")), |
| 545 | ), |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | testCase.Cleanup = func(data test.Data, helpers test.Helpers) { |
| 550 | if data.Labels().Get("composeYAML") != "" { |
| 551 | helpers.Anyhow("compose", "-f", data.Labels().Get("composeYAML"), "down", "-v") |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | testCase.Run(t) |
| 556 | } |
| 557 | |
| 558 | func TestComposeIPAMConfig(t *testing.T) { |
| 559 | testCase := nerdtest.Setup() |
nothing calls this directly
no test coverage detected
searching dependent graphs…