toxiproxy icon indicating copy to clipboard operation
toxiproxy copied to clipboard

Test retries with toxiproxy

Open JonGerding opened this issue 3 years ago • 3 comments

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.

JonGerding avatar Jul 14 '22 10:07 JonGerding

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.

miry avatar Jul 14 '22 11:07 miry

Does that mean we can test grpc retry using toxiproxy? It uses TCP

ccoltx avatar Mar 20 '23 13:03 ccoltx

@ccoltx Toxiproxy does not know about content of high level protocol.

There are solutions:

  1. 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.
  1. 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

miry avatar Mar 20 '23 13:03 miry