MCPcopy Index your code
hub / github.com/testcontainers/testcontainers-go / TestShouldStartContainersInParallel

Function TestShouldStartContainersInParallel

container_test.go:478–503  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

476}
477
478func TestShouldStartContainersInParallel(t *testing.T) {
479 ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
480 t.Cleanup(cancel)
481
482 for i := range 3 {
483 i := i
484 t.Run(fmt.Sprintf("iteration_%d", i), func(t *testing.T) {
485 t.Parallel()
486
487 ctr, err := testcontainers.Run(
488 ctx, nginxAlpineImage,
489 testcontainers.WithExposedPorts(nginxDefaultPort),
490 testcontainers.WithWaitStrategy(wait.ForHTTP("/").WithStartupTimeout(10*time.Second)),
491 )
492 testcontainers.CleanupContainer(t, ctr)
493 require.NoError(t, err)
494
495 // mappedPort {
496 port, err := ctr.MappedPort(ctx, nginxDefaultPort)
497 // }
498 require.NoError(t, err)
499
500 t.Logf("Parallel container [iteration_%d] listening on %d\n", i, port.Num())
501 })
502 }
503}
504
505func ExampleGenericContainer_withSubstitutors() {
506 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

ForHTTPFunction · 0.92
MappedPortMethod · 0.65
CleanupMethod · 0.45
RunMethod · 0.45
WithStartupTimeoutMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…