testcontainers / testcontainers/testcontainers-java
JdbcDatabaseContainer ignores set WaitStrategy
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
The JdbcDatabaseContainer overwirtes the method waitUntilContainerStarted() of GenericContainer but does not call super.waitUntilContainerStarted(). So the WaitStrategy set via waitingFor() is not applied. This is really confusing because you wonder why the set WaitStrategy is not called.
Please add super.waitUntilContainerStarted() at the beginning of waitUntilContainerStarted() in JdbcDatabaseContainer. E.g.:
@Override
protected void waitUntilContainerStarted() {
super.waitUntilContainerStarted();
logger().info("Waiting for database connection to become available at {} using query '{}'", getJdbcUrl(), getTestQueryString());
// Repeatedly try and open a connection to the DB and execute a test query
....
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
In JdbcDatabaseContainer, inspect the overridden waitUntilContainerStarted() method and how GenericContainer applies waitingFor(). Add the superclass call at the start, then verify that a configured WaitStrategy runs before the database connection checks; the issue does not name a specific test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100