-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow additional waiting strategy for the Database to be available #136
Comments
Relates to #123 |
Just chiming in with some experiences:
One would think so, but it is explicitly flaky in the case of the default PostgreSQL image. This originates from the fact, that the PostregeSQL database restarts after bootstrapping its internal tables if the database was started without a data directory being present. This allowed for a small window of a race condition, where the JDBC query would succeed, but the database engine would proceed to perform the restart. The Regarding the different behavior, I like to point to this comment: Rancher Desktop has vastly different runtime characteristics compared to Docker Desktop and Testcontainers does not plan to support them explicitly. That being said, for the issue at hand, using |
Feature description
Unfortunately, there is something different with timing when Rancher Desktop is used which makes Postgres (probably Oracle) container tests fail because it's reported as ready(it uses
LogMessageWaitStrategy
), but it still takes some time for the port to be exposed or something...It would be nice to have some additional availability checks that can be enabled. I can see two options:
Await for successful SQL query, that is the default Testcontainers check:
https://github.com/testcontainers/testcontainers-java/blob/7ba6b1c518d8f181b5831229977c260dbff803dc/modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java#L143-L175
Unfortunately, it's overridden by Postgres and Oracle with
LogMessageWaitStrategy
.This check might be the most bulletproof but might need a custom configuration of the SQL check query.
Wait for the port to be available. We can probably reuse Testcontainer's
HostPortWaitStrategy
.The text was updated successfully, but these errors were encountered: