testcontainers / testcontainers/testcontainers-java
Using a postgres image with mounted `/data` fails on LogWaitStrategy
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Testcontainer:
version: 1.14.3
Postgres:
version: 5.6-alpine
output:
PostgreSQL Database directory appears to contain a database; Skipping initialization
LOG: database system was interrupted; last known up at 2020-10-13 08:45:54 UTC
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 0/14F0430
LOG: invalid record length at 0/3356CD0: wanted 24, got 0
LOG: redo done at 0/3356CA8
LOG: last completed transaction was at log time 2020-10-13 08:46:42.609873+00
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
Expected behavior:
- Container started successfully
Exception:
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*database system is ready to accept connections.*\s'
at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:31)
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" twice withTimes(2), the container readiness check fails.
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
Start in modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java at the referenced wait-strategy registration, then read LogMessageWaitStrategy.waitUntilReady. Reproduce the case with a PostgreSQL container using a mounted /data directory and verify that startup completes without the readiness timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, postgresql
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100