Simulate network failures in integration tests with Toxiproxy
Use Toxiproxy when an agent needs to inject latency, disconnects, bandwidth limits, or packet-like failure modes into real service calls during development, CI, or incident reproduction. The agent routes app traffic through controlled TCP proxies, applies toxics at the right moment, and reports which dependency paths fail gracefully versus which ones crack under stress.
Prerequisites
Toxiproxy server plus a client library or HTTP API access from the test harness
Installation
Use the upstream install or setup path that matches your environment:
- $ brew tap shopify/shopify
- $ brew install toxiproxy
- $ docker pull ghcr.io/shopify/toxiproxy
- $ docker run --rm -it ghcr.io/shopify/toxiproxy
Requirements and caveats from upstream:
- cross-platform and require root, which makes them problematic in test,
- toxiproxy-python
- toxiproxy-node-client
Basic usage or getting-started notes:
Toxiproxy usage consists of two parts. A TCP proxy written in Go (what this
and can then manipulate their health via HTTP. See Usage
For example, to add 1000ms of latency to the response of MySQL from the [Ruby
Extracted from upstream docs: https://raw.githubusercontent.com/Shopify/toxiproxy/HEAD/README.md