Skip to content

Remove the Uuid test seam from public constructors #1561

Open

Description

@cristianrgreco

What happens

Three public constructors take a Uuid parameter that exists only so tests can inject deterministic names:

  • new Network(uuid?)
  • new DockerComposeEnvironment(composeFilePath, composeFiles, uuid?)
  • new GenericContainerBuilder(context, dockerfileName, uuid?)

It is the reason Uuid, RandomUuid and randomUuid are exported from the package. For Network it is the only constructor parameter, which takes the slot that real options would use.

Expected

Public constructors take only user-facing arguments. Tests get deterministic names another way, for example a withName/withProjectName style setter or an internal factory.

Where

  • packages/testcontainers/src/network/network.ts
  • packages/testcontainers/src/docker-compose-environment/docker-compose-environment.ts
  • packages/testcontainers/src/generic-container/generic-container-builder.ts

Notes

  • Removing a constructor parameter and the Uuid exports is breaking, hence major.
  • DockerComposeEnvironment already has withProjectName, which covers its use of the seam.

Dependencies

Activity

  1. added
    maintenanceImprovements that do not change functionality
    majorAn incompatible API change
    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 functionalitymajorAn incompatible API change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions