Tuesday 19 November 2019

Chaos testing Azure Service Bus with Toxiproxy


Toxiproxy runs as a docker container.

On Docker for Windows, run it in bridge networking (the default). In this the containers are isolated and so to access the port from the host it must be published. Run the container with:
docker run -it -p 8474:8474 -p 443:443 -p 5671:5671 -p 5672:5672 shopify/toxiproxy

This exposes port 8474 (the HTTP API), 443 for HTTPS and ports 5671 and 5672 for proxying Azure Service Bus on AMQP.

You can configure the proxy either by using the client SDK or by using the shell.
To attach the shell:
Docker exec -it <container ID> /bin/sh

To create a proxy for AMQP for ASB, first determine the IP address of the service.
NSLlookup <FQDN of ASB service>

In the shell type:
./toxiproxy-cli create amqp --listen --upstream <IP address of ASB service>:5671

To add upstream and downstream latency:
./toxiproxy-cli toxic add -n downlatency -t latency -a latency=8000 -d amqp

./toxiproxy-cli toxic add -n uplatency -t latency -a latency=8000 -u amqp


If you need to test any network connectivity you can use
docker run --rm -it praqma/network-multitool bash

No comments:

Post a Comment