Skip to content

fix(core): preserve query strings in HTTP wait URLs - #1148

Open
henricop wants to merge 1 commit into
testcontainers:mainfrom
henricop:fix/http-wait-url-query
Open

henricop wants to merge 1 commit into
testcontainers:mainfrom
henricop:fix/http-wait-url-query

Conversation

@henricop

@henricop henricop commented Nov 7, 2026

Copy link
Copy Markdown

HttpWaitStrategy.from_url("http://localhost:8080/health?ready=true") currently sends GET /health, dropping the query string. Health endpoints that require query parameters can therefore time out or validate the wrong request. The urlparse call also drops semicolon parameters from the final path segment.

Preserve the complete request target with urlsplit, and append the original query without decoding or re-encoding it. Fragments remain excluded from HTTP requests; port and TLS handling are unchanged.

Validation on main at 6146aa1170f415fcc825ed9bddc4eacbeb937a12:

  • All five new cases fail before the source change; 92 wait-strategy tests pass afterward.
  • Wait-strategy and utility suites: 105 passed.
  • Six probes using a real HTTP server on 127.0.0.1 confirm the actual request targets, including repeated/blank parameters, encoded characters, semicolon path parameters, root paths and fragments. The mapped-port target is a stub, not a Docker container.
  • All repository pre-commit formatting/Ruff/TOML/whitespace hooks pass. The full mypy hook reports five identical existing errors on the base and the patch (Docker stub _RestartPolicy export and four NetworkCollection.list calls); no new diagnostics. The changed source file typechecks.

The local Docker Desktop API did not respond to bounded probes, so Docker integration tests were not run. Python 3.13; mypy 2.3.0 and types-docker 7.2.0.20260728 were taken from uv.lock.

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.41%. Comparing base (6146aa1) to head (c7c5a71).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
+ Coverage   86.39%   86.41%   +0.01%     
==========================================
  Files          16       16              
  Lines        1772     1774       +2     
  Branches      198      199       +1     
==========================================
+ Hits         1531     1533       +2     
  Misses        181      181              
  Partials       60       60              
Files with missing lines Coverage Δ
src/testcontainers/core/wait_strategies.py 78.43% <100.00%> (+0.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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