Skip to content

Add a shared contract test for modules #1576

Open

Description

@cristianrgreco

What happens

Each module tests its own happy path. Behaviour that every module should share is not tested per module, so regressions in it pass every suite:

  • starting the same builder twice
  • connecting after restart(), when the mapped ports have changed
  • withReuse() returning the same container, with the module's setup run once
  • a network alias being usable from another container
  • cleanup through await using
  • non-default credentials actually being applied

Expected

A shared contract test that each module runs against its own container:

describeModuleContract({
  create: () => new RedisContainer(IMAGE),
  connect: async (container) => {
    /* resolves when a client can use the container */
  },
});

Where

  • the shared helper in packages/testcontainers/src/utils/test-helper.ts, which modules may already import
  • one call in each packages/modules/*/src/*-container.test.ts

Notes

  • No new images: each module uses the image it already tests with.
  • Some checks will fail on main until the bugs they cover are fixed. Those are the red tests for the fixes.

Dependencies

Activity

  1. added
    maintenanceImprovements that do not change functionality
    patchBackward compatible bug fix
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceImprovements that do not change functionalitypatchBackward compatible bug fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions