-
-
Notifications
You must be signed in to change notification settings - Fork 251
Description
On a fast linux machine with a fast runtime (like Bun), starting the reaper RYUK image finishes before you attach the waitStrategy.
You appear to start the container on line 196
But only wait for the container on line 225
Expected Behaviour
For the logs to be read even when the container instantly starts
Actual Behaviour
You look for the logs after they have already been sent
Testcontainer Logs
2025-04-04T11:43:56.998Z testcontainers [DEBUG] [6ccdcca4a1fa] Starting container...
2025-04-04T11:43:57.123Z testcontainers [DEBUG] [6ccdcca4a1fa] Started container
2025-04-04T11:43:57.123Z testcontainers [INFO] [6ccdcca4a1fa] Started container for image "testcontainers/ryuk:0.11.0"
2025-04-04T11:43:57.125Z testcontainers [DEBUG] [6ccdcca4a1fa] Fetching container logs...
2025-04-04T11:43:57.125Z testcontainers [DEBUG] [6ccdcca4a1fa] Demuxing stream...
2025-04-04T11:43:57.125Z testcontainers [DEBUG] [6ccdcca4a1fa] Demuxed stream
2025-04-04T11:43:57.125Z testcontainers [DEBUG] [6ccdcca4a1fa] Fetched container logs
2025-04-04T11:43:57.126Z testcontainers [DEBUG] [6ccdcca4a1fa] Waiting for container to be ready...
2025-04-04T11:43:57.126Z testcontainers [DEBUG] [6ccdcca4a1fa] Waiting for log message "/.Started./"...
Docker Logs
time=2025-04-04T11:43:57.122Z level=INFO msg=starting connection_timeout=1m0s reconnection_timeout=10s request_timeout=10s shutdown_timeout=10m0s remove_retries=10 retry_offset=-1s changes_retry_interval=1s port=8080 verbose=false
time=2025-04-04T11:43:57.123Z level=INFO msg=Started address=[::]:8080
time=2025-04-04T11:43:57.123Z level=INFO msg="client processing started"
Notice testcontainers starts waiting at 2025-04-04T11:43:57.126Z
Docker has already finished 3ms before at 2025-04-04T11:43:57.123Z (Sometime the gap is bigger and sometimes it starts later and so sees the log message.
Steps to Reproduce
- Have fast linux machine with native docker
- Use Bun
- Start any test container (we were trying Postgres but it does not get that far)
- Test will hang
- Check logs
Environment Information
- Operating System: Ubuntu 24.04
- Docker Version: 26.1.3
- Bun version: 1.2.3
- Testcontainers version: 10.24.0
- CPU: Intel i9 12900k
- RAM: 32gb
- HD: WD Black SN750
- GPU: 4070
Solution
Either buffer the output or attach before calling start