from Hacker News

Ask HN: How do I force network failures during development against remote APIs?

by I_dev_outdoors on 7/25/22, 9:21 PM with 3 comments

I am working on a gateway product and would like to start focusing on reliability and handling intermediate networking errors. What are some techniques and tools I can use to force them so that I can write code that gracefully handles them? I am thinking stuff like certificate errors, DNS lookup failures, socket disconnected errors, timeouts, invalid data returned over the socket when expecting HTTP.

Thanks.

  • by mneil on 7/25/22, 10:08 PM

    https://github.com/Shopify/toxiproxy is a perfect solution for that. I used it quite successfully years ago and it looks like it's still pretty active.
  • by sethammons on 7/26/22, 1:58 AM

    Take a look at https://github.com/tylertreat/comcast

    > Comcast is a tool designed to simulate common network problems like latency, bandwidth restrictions, and dropped/reordered/corrupted packets

  • by I_dev_outdoors on 7/25/22, 9:40 PM

    I found https://badssl.com/ which at least helps me with the SSL cert issues, but I would still love to hear any other good solutions for testing other types of networking errors.