Toxiproxy, a framework to simulate network conditions in test environments

Shopify, which develops one of the largest and most popular e-commerce platforms on the web, dio recently announced that it has launched the new version of the proxy server «Toxiproxy 2.3» which is designed to simulate failures and anomalies in the network and the system to test the state of the applications when such conditions occur.

The program stands out for providing an API to dynamically change the characteristics of the communication channel, which can be used to integrate Toxiproxy with unit test systems, in addition to also having support for continuous integration platforms and development environments.

About Toxiproxy

This framework is specifically designed to work in test environments, CI and development, and supports deterministic manipulation of connections, but with support for random chaos and customization.

Basically, Toxiproxy is positioned as a tool that all those who require perform demo tests on applications that do not have single points of failure. Toxiproxy has been using successfully in all development and testing environments on Shopify since October 2014.

The use of toxiproxy consists of two parts. A TCP proxy written in Go (what this repository contains) and a client that communicates with the proxy via HTTP. This configures the application so that all test connections go through Toxiproxy and then can manipulate their status through HTTP.

In other words, the proxy it is launched between the application being tested and the network service with which this application interacts, after which you can simulate the occurrence of a certain delay when receiving a response from the server or sending a request, change the bandwidth, simulate a refusal to accept connections, interrupt the normal course of establishment or closure of connections, reestablish established connections , distort the contents of the packages.

To control the operation of the proxy server from applications, client libraries for Ruby, Go, Python, C # /. NET, PHP, JavaScript / Node.js, Java, Haskell, Rust and Elixir are provided, which allow you to change the interaction conditions network on the fly and immediately evaluate the result.

To change the characteristics of the communication channel without making changes to the code, a special toxiproxy-cli utility can be used (the Toxiproxy API is supposed to be used in unit tests and the utility can be useful for interactive experiments).

What's new in Toxiproxy 2.3?

As for the changes that are included in the new version released, it is mentioned that there is the inclusion of a client endpoint controller for HTTPS.

As well as the separation of typical test drivers into separate files, the implementation of the client.Populate API.

In addition to this, the support for armv7 and armv6 platforms and the ability to change the registry level for the server is also highlighted.

Install Toxiproxy on Linux

For those who are interested in being able to install this framework to be able to carry out their tests, they can do this following the steps that we share below.

If you are a user of Debian, Ubuntu or any other distribution based on these, You can perform the installation by opening a terminal (you can use the keyboard shortcut Ctrl + Alt + T) and in it you will type:
wget https://github.com/Shopify/toxiproxy/releases/download/v2.3.0/toxiproxy_2.3.0_linux_amd64.deb

And we proceed to perform the installation with:
sudo apt install ./toxiproxy_2.3.0_linux_amd64.deb

In the case of those that are users of distributions with support for RPM packages, such as Fedora, openSuse, RHEL, among others, the package to download is the following:
wget https://github.com/Shopify/toxiproxy/releases/download/v2.3.0/toxiproxy_2.3.0_linux_amd64.rpm

And you install the package by typing:
sudo rpm -i toxiproxy_2.3.0_linux_amd64.rpm

Once the installation is done, you can start the service by executing the following command in the terminal:
sudo service toxiproxy start

Finally if eYou are interested in being able to know more about it, You should know that the Toxiproxy code is written in Go and has the MIT license and you can consult the manual for using this framework in the following link


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.