testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
7.99k stars 1.64k forks source link

Feature/postponed env read #8824

Open simpletasks opened 3 months ago

simpletasks commented 3 months ago

Related to issue #8823

Replace field declaration in ContainerDef: Map<String, String> envVars = new HashMap<>(); with Map<String, Supplier<String>> envVars = new HashMap<>();

simpletasks commented 2 months ago

I added a positive test showing a combination of .dependsOn() and .withEnv() when the dependent container depends on the mapped port of another container.

simpletasks commented 2 months ago

I added a negative test showing failure in test setup using @Container annotation and a combination of .dependsOn() and .withEnv() methods when the dependent container depends on the mapped port of another container.