-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Using a postgres image with mounted /data
fails on LogWaitStrategy
#3372
Comments
I'm curious why the regex here is looking for a trailing whitespace character? I use the following for a postgres container and it works like a charm:
Note that I use I think the current Predicate<OutputFrame> waitPredicate = outputFrame ->
// (?s) enables line terminator matching (equivalent to Pattern.DOTALL)
outputFrame.getUtf8String().matches("(?s)" + regEx); I'm happy to PR such a change if it makes sense. |
encountered this too |
@jerryleooo Unfortunately that issue still exists. Happy to support if someone wants to have a look at it. Last time we (i.e. @TomCools) tried it, we were not able to find a consistent wait strategy implementation for both conditions, no data and pre-existing data: #5501 That being said, AFAIK @TomCools still implemented a workaround internally in the past, maybe he can share it again to unblock you. |
@jerryleooo and @kiview. I'd have to go looking for the code that fixes this for both data/no-data cases. As you mentioned, it didn't work out back then. In the meantime, my workaround is to just use a custom waiter if I know that the database is populated: https://github.com/TomCools/modern-testing-patterns/blob/5dde521e709a1273696f581e08ee743194245a23/testcontainers/src/test/java/be/tomcools/moderntestingpatterns/testcontainers/additional/updatecontainer/ExampleTestUsingContainerWithData.java#L32 |
Testcontainer:
version: 1.14.3
Postgres:
version: 5.6-alpine
output:
Expected behavior:
Exception:
Issue:
Because the image skep the initialization and the code on PostgresSQLContainer:56 is registering the
LogMessageWaitStrategy
to match the line".*database system is ready to accept connections.*\\s"
twicewithTimes(2)
, the container readiness check fails.The text was updated successfully, but these errors were encountered: