-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol aware toxics #50
Comments
This would be neat. I'd like to be able to return HTTP 404 and test that. |
@dwradcliffe it's completely possible to build already BTW if you really need it. We just haven't. Thanks for the input on a use-case :-) |
My specific use-case is for elasticsearch. ES often returns non-200 responses when things are not quite right or when the request was routed to the wrong place. |
I wrote a simple HTTP toxic while writing the docs for 2.0 If you're up for it, you could modify it for ES, and compile it in to the 2.0-dev branch. You may also be interested in looking at https://github.com/Shopify/toxiproxy/blob/2.0-dev/CREATING_TOXICS.md |
@xthexder how about taking the HTTP toxic into core? |
The toxic needs some work to generalize the usage, since it needs to be controllable via json, but it's definitely something we can put in core. |
This might be interesting to bring up again. I'm not sure of all the use-cases for this, but a couple things I can think of to put as options are:
I can work on implementing some of these, but I'd like to hear some others opinions. For some of the things I'm thinking of, there's the problem that downstream toxics can't read any information from the upstream / request, so things can't be filtered based on URL for example. |
The status code change one would be interesting for sure, adding removing random headers, etc., would all be awesome.
Ugh, this is a great point. How hard would it be to add this information though? |
I'm currently looking at it, and I think it's possible to add, it just might be a little messy with matching corresponding upstream/downstream toxics together. |
Is there any update to this functionality? It's the only thing missing for us to be able to fully use toxiproxy. |
@aebicalho: We have two open PRs that add this functionality. There's no one currently trying to get them out the door. They need a champion to make it happen. I'd love to get to it at some point but I have higher priorities at this moment. |
I created an http toxic, based on the work from @xthexder, so that I could modify the host header. |
@worldtiki how do you use this toxic? I compiled your version of toxiproxy but i'm not able to add a http toxic neither from the CLI nor from a client. $ ./toxiproxy-cli toxic add api_core_slow -t http_request_headers -a headers=Host:host.net
Toxic attributes was expected to be an integer. |
Hi @maxgalbu! If you forked my repo then make sure you use the branch http_toxic and not master, as the master has other changes that have not been tested (some experiments I was doing). I was able to use the http toxic successfully with these configs: Initial proxies config: If I curl 127.0.0.1:8474/proxies I get this: And if I add the following toxic with curl -X POST 127.0.0.1:8474/proxies/example/toxics -d @example.json: I can curl toxiproxy again and confirm it was added successfully:
And if I curl 127.0.0.1:9091 I will go to www.example.com You're probably missing some params (stream: upstream, ...). Try doing a post instead of using the client to confirm it works and then go from there. ps: I'll update this pr with an example: #215 |
@worldtiki thanks for your example
Please also share how to build your toxiproxy :) |
@maxgalbu just clone my repo, checkout the branch http_toxic and run If you want you can pull this docker image: worldtiki/toxiproxy:1.7 |
Ok i was probably doing something wrong, the docker image works fine. Thanks |
We could build protocol aware toxics, e.g.
The text was updated successfully, but these errors were encountered: