Skip to content

Testcontainers best practices recipes #438

Description

@timtebeek

Based on this nice article from @sivaprasadreddy
https://www.atomicjar.com/2023/11/testcontainers-best-practices/

What problem are you trying to solve?

Automate some of the best practices for testcontainers, such that users can adopt these with little effort, unlocking a move to testcontainers cloud in some areas.

  • Don’t rely on fixed ports for tests
  • Don’t hardcode the hostname
  • Don’t hardcode the container name
  • Copy files into containers instead of mounting them
  • Use the same container versions as in production
  • Use proper container lifecycle strategy
  • Leverage your framework’s integration for Testcontainers
  • User preconfigured technology-specific modules when possible
  • Use WaitStrategies to check the container is ready

Any additional context

In part also discussed on

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Recipes Wanted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions