Adds a ToxiproxyContainer under testcontainers.community.toxiproxy for
simulating adverse network conditions (latency, bandwidth limits,
connection drops, ...) in integration tests, mirroring the Toxiproxy
modules already available for testcontainers Java, Go and .NET.
- ToxiproxyContainer exposes the HTTP control API and a range of proxy
ports and provides create_proxy() to route traffic to an upstream.
- ToxiproxyProxy.add_toxic() injects toxics via the control API.
- No extra runtime dependencies (the control API is called over urllib).
- Adds an integration test (proxying + latency toxic), a docs page and
example, and the community extra in pyproject.
New Container
Fixes #1104
Adds a ToxiproxyContainer (testcontainers.community.toxiproxy) that wraps Toxiproxy for simulating adverse network conditions — latency, bandwidth limits, connection drops and more — in integration tests. Toxiproxy modules already exist for testcontainers Java, Go and .NET; this brings the same to Python.
What it does
Usage
The included integration test starts nginx behind Toxiproxy, verifies traffic flows through the proxy, then injects a latency toxic and asserts the response is delayed.
PR Checklist