Skip to main content

On This Page

Stop Mocking Everything: How to Test API Resilience in Your Terminal (Curl + Chaos Proxy)

2 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

Stop Mocking Everything: How to Test API Resilience in Your Terminal (Curl + Chaos Proxy)

A chaos proxy injects 7-second delays and 100% 503 errors into real API requests. This method tests resilience without modifying application code.

Why This Matters

Local development environments are artificially stable, masking real-world issues like latency, intermittent failures, and throttling. Production systems face unpredictable network conditions, yet 50% of outages stem from unhandled API failures. Simulating these scenarios is critical to avoid cascading failures in deployment pipelines or cron jobs.

Key Insights

  • “7-second delay, 100% 503 errors via chaos-proxy.debuggo.app”: Demonstrated in the tutorial.
  • “Chaos proxies over mocks for API testing”: Enables realistic failure injection without writing mock servers.
  • “Chaos Proxy used by developers for resilience testing”: Example includes curl integration with proxy rules.

Working Example

# Inject 7-second delay and 503 errors into httpbin.org
curl -v -x http://user:[email protected]:13979 https://httpbin.org/get
# Output during chaos injection (Scenario A)
< HTTP/1.1 500 Internal Server Error
< content-length: 56
< content-type: text/plain
Debuggo Chaos Injection: 500 Error
# Output during successful request (Scenario B)
< HTTP/1.1 200 OK
{
  "args": {},
  "headers": { ... }
}

Practical Applications

  • Use Case: CI Pipelines: Verify deployment scripts handle slow dependencies.
  • Pitfall: Over-reliance on mocks leading to unprepared systems for real failures.

References:


Continue reading

Next article

Grouping Tests with @Suite in Swift Testing

Related Content