Repository navigation
Conversation
`GenericContainer.start()` waits for host port bindings via `inspectContainerUntilPortsExposed` before the wait strategy runs, but neither call site passed `this.startupTimeoutMs`, so that pre-wait was always capped at the util's 10 s default and `withStartupTimeout()` did not apply to it. Pass the configured value at both call sites; when no startup timeout was configured the argument is `undefined` and the 10 s default still applies. Fixes testcontainers#1446 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthrough
ChangesContainer startup timeout
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to Containers configured with a longer wait-strategy timeout can still fail during slow port binding. Propagate the effective timeout before merging unless this limitation is explicitly accepted. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The configured timeout now applies to the port-binding wait as well as the later readiness wait. The change does not add permissions or network exposure. Docker-backed integration behavior remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b917d69b3c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| () => client.container.inspect(container), | ||
| container.id | ||
| container.id, | ||
| this.startupTimeoutMs |
There was a problem hiding this comment.
Add a regression test for the timeout path
This bug fix changes GenericContainer.start() behavior, but there is no test proving that a custom withStartupTimeout() lets the port-binding pre-wait run past the utility's 10s default; a future refactor could silently reintroduce the cap. Please add a focused regression test around this startup path that fails before the change and passes after it.
AGENTS.md reference: AGENTS.md:L29-L34
Useful? React with 👍 / 👎.
|
Thanks for raising the PR, apologies for the delay in reviewing it. Looks good but a few gaps:
|
withStartupTimeout() to the port-binding pre-wait
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Use the configured wait-strategy timeout for the port pre-wait. · generic-container.ts:173
packages/testcontainers/src/generic-container/generic-container.ts:173
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse the configured wait-strategy timeout for the port pre-wait.
When
withWaitStrategy()supplies a timeout withoutGenericContainer.withStartupTimeout(), both pre-wait calls use the helper's 10,000 ms default. Startup can fail before the wait strategy runs.When the container timeout is undefined, pass the configured wait-strategy timeout to
inspectContainerUntilPortsExposed()in both startup paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f2256eb5-fa0b-4bdb-b61a-ec0e6967091e
📒 Files selected for processing (1)
packages/testcontainers/src/generic-container/generic-container.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
|
For reference, we're running a patch on 11.14.0 that addresses all five review points. Details, measurements and a deterministic fault-injection reproduction are in #1446 (comment):
Unpatched with a simulated 15 s bind delay, the start fails at 10.6 s; patched, it succeeds at 15.2 s. Glad to contribute these changes or tests here if useful. |
Sure @behzadardehei , thank you. |
|
Thanks @kenzox and @behzadardehei for the report, measurements and reproduction. Tying this wait to the startup timeout means the two phases can each consume the full budget, so a 10 min timeout could wait close to 20 min. I've gone with a fixed, larger limit instead in #1494, which covers the measured 16.7 s case without changing what |
Fixes #1446.
GenericContainer.start()waits for host port bindings (inspectContainerUntilPortsExposed) before the wait strategy runs, but neither call site passesthis.startupTimeoutMs, so that pre-wait is always capped at the util's 10 s default andwithStartupTimeout()does not apply to it.This passes
this.startupTimeoutMsat both call sites (reuseContainerandstartContainer). When no startup timeout was configured the argument isundefinedand the existing 10 s default still applies, so behaviour only changes for callers who explicitly asked for a longer budget.Measured (12.1.0, six
postgres:18-alpinecontainers starting concurrently on a 2-vCPU GitHub runner): port binding took up to 16.7 s and failed at 10 s despitewithStartupTimeout(120_000); with this change the same suite passes.Verified locally on the branch:
npm ci→ 0,tsc -p packages/testcontainers/tsconfig.json --noEmit→ 0, eslint → 0, prettier → 0. The Docker-backed integration suite was not run here.