Test retries with toxiproxy
Hi, i would like to test the retry function of my application which sends up to three HTTP-requests to an external API if it didn't get a response. Is it possible to implement a function to toxiproxy that it discard the first two requests or a function that toxiproxy discard all requests in a specific period of time x and continues after that.
It is not possible in current state. Toxiproxy is only TCP proxy. There are still some old PRs that would partially allow to support HTTP protocol.
There is a good discussion in https://github.com/Shopify/toxiproxy/pull/215. There are some suggestion to use https://designer.mocky.io/ or similar.
Does that mean we can test grpc retry using toxiproxy? It uses TCP
@ccoltx Toxiproxy does not know about content of high level protocol.
There are solutions:
- Use toxiproxy client in test to test on Networking level. Example:
Toxiproxy[grpc_server].down do
GRPC.call # -> Failed with networking problem
GRPC.call # -> Failed with networking problem
end
GRPC.call # -> Success to setup conneciton and process the request.
- Create a new Toxic
grpc, that would process incoming requests and do some problems. Example: https://github.com/Shopify/toxiproxy/blob/master/_examples/toxics/http_toxic.go