Skip to content

test: cover HttpWaitStrategy response predicate retries - #11976

Open
jjj-n wants to merge 1 commit into
testcontainers:mainfrom
jjj-n:codex/issue-2516-response-predicate-test
Open

test: cover HttpWaitStrategy response predicate retries#11976
jjj-n wants to merge 1 commit into
testcontainers:mainfrom
jjj-n:codex/issue-2516-response-predicate-test

Conversation

@jjj-n

@jjj-n jjj-n commented Aug 24, 2026

Copy link
Copy Markdown

What does this PR do?

Adds deterministic regression coverage for HttpWaitStrategy.forResponsePredicate.

The test uses a local HTTP endpoint that returns not-ready for the first request and ready for the second request. It verifies that the wait strategy retries the response predicate and succeeds after the response becomes acceptable.

The test does not require Docker.

Why is this needed?

Issue #2516 reported that response predicates might only be evaluated once.

The current implementation on main already retries correctly because a predicate mismatch is raised inside retryUntilSuccess. This test protects that behavior from future regressions.

Related to #2516

@jjj-n
jjj-n requested a review from a team as a code owner August 24, 2026 03:18
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f679adc-a13c-4e70-bb8a-53196bac65fd

📥 Commits

Reviewing files that changed from the base of the PR and between ed2c487 and f33f206.

📒 Files selected for processing (1)
  • core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Summary by CodeRabbit

  • Bug Fixes
    • Improved HTTP readiness checks to retry when an endpoint initially reports that it is not ready.
    • Confirmed readiness succeeds once the expected response is received.
    • Added verification that requests stop after the service becomes ready.

Walkthrough

The test adds a local HTTP server that returns "not-ready" once and "ready" next. It verifies that HttpWaitStrategy retries, succeeds with a response predicate, and makes exactly two requests.

Changes

HTTP wait strategy retry validation

Layer / File(s) Summary
Response-predicate retry test
core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java
The test starts a local server, configures HttpWaitStrategy, verifies retry-based readiness, counts two requests, and stops the server in a finally block.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f33f2

This PR adds localized regression coverage without changing production behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: kiview, eddumelendez

Poem

A rabbit checked the server door,
“Not ready” came once, then no more.
The next reply said “ready” bright,
Two hops confirmed the wait was right.
The test tucked cleanup safely tight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description explains the change, its context, the regression behavior, and the related issue.
Title check ✅ Passed The title clearly and concisely identifies the regression test for HttpWaitStrategy response predicate retries.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant