Shopify / toxiproxy

:alarm_clock: :fire: A TCP proxy to simulate network and system conditions for chaos and resiliency testing
https://github.com/shopify/toxiproxy
MIT License
10.82k stars 449 forks source link

Upstream aware toxics #244

Open chbatey opened 5 years ago

chbatey commented 5 years ago

I'd like to be able to write toxics that are upstream aware e.g. drop if client's IP = x.

This will be useful for testing peer 2 peer systems rather than client server.

The usecase I have in mind is for a service that forms a cluster e.g. a Cassandra Cluster or an Akka Cluster I'd like to have toxi proxy between each P2P connection and be able to simulate a node misbehaving. As these are P2P systems each node will connect to a subset of other nodes so I only wan to disrupt incoming traffic from a given source.

To support this I think we'd need to add more information to ToxicStub or create a new toxic type.

WDYT? Is this something you'd accept if I worked on it?

jpittis commented 5 years ago

Heya @chbatey!

One way to do that would be to add more information about the connection to the ToxicStub as you suggest. I can't think of a better approach. I think we'd accept something like this.

(Mostly unrelated, FYI that https://github.com/Shopify/toxiproxy/issues/50 protocol aware toxics have been a WIP for a while.)

chbatey commented 5 years ago

Thanks @jpittis I raised https://github.com/Shopify/toxiproxy/pull/246 and have been testing with it and some custom toxics and it works. We could instead not have a toxic added to the link rather than all the toxics that want to be client specific doing the check.

xthexder commented 5 years ago

I'm not sure how useful this is, since it's a fairly old PR, but some of the code in https://github.com/Shopify/toxiproxy/pull/132 might be helpful for this.