testcontainers / testcontainers/testcontainers-java

JdbcDatabaseContainer ignores set WaitStrategy

Open
#2,994 6 comments 3 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.