Head back to Documentation
This project periodically runs integration tests on a 6 node testnet
Clone this repo
You will need at least python 3.5
Follow the corresponding instructions:
OS | Link |
---|---|
Windows | Docker for Windows |
Linux | https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ |
OSX | https://docs.docker.com/docker-for-mac/install/ |
# Install docker compose
bashpip3 install docker-compose
INFO: Make sure you have
PYTHONPATH
set (e.g.export PYTHONPATH=$(pwd)
), otherwise you could receiveModuleNotFoundError
# Run pytest
pytest
# To run a specific scenario use -m flag
pytest -s -m "runfor10minutes"
# To avoid running a scenario
pytest -s -m "not runfor10minutes"`
The qrlnet directory contains all the scripts to start a qrl network from scratch.
qrlnet/start_net.sh is the main script. There are a few arguments that are particularly useful:
REPO_XXX # allow for launching this local testnet using source code from a different repo/branch
LOCAL_NET_ONLY # option indicates that nodes should be isolated and should not connect outside the integration test.
INTEGRATION_TESTINPLACE # Indicates that source code should not be retrieved. This is used to run the integration tests locally. In particular as a submodule as it is done in https://github.com/theQRL/QRL
When the script is executed, it will launch several docker-compose nodes/containers.
Each node will run
qrlnet/node_scripts/start.sh
This scripts prepares the container to run a qrl node (user permissions, etc.)
Finally, each node will switch to testuser and start a node
This local network could be used for any purposes.
At the moment, a few example tests derive from TestLogParser. This base class starts a network and allows for monitoring the logfiles of the running nodes. A few very simple tests like checking that nodes sync or throw exceptions can be done.
However, this is not ideal and are just examples as a proof of concept.
We expect to extend test to go through the grpc API, use direct CLI, interact directly with the network configuration, etc.
Example: Use something similar to
qrlnet/nodes_scripts/docker_helper.py
Using the Docker SDK, it is possible to determine each node IP address based on their name and run commands or scripts directly inside the corresponding containers using
exec_run
https://docker-py.readthedocs.io/en/stable/containers.html
This way it would be possible to test the CLI or node.js apps (wallet/explorer) from inside the container. More complex tests could confirm transfers by running CLI on more than one node.
The Docker SDK could be also use to model network issues/errors. etc.
The integration tests have been designed to run primarily in Travis/Ubuntu. We would like to move to CircleCI in near future.
Docker for Mac has some limitations that result in problems when trying to connect from the host to the containers. https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds
Typically in Linux, you can route traffic between your host and each of the containers without trouble using a Bridge. This is unfortunately not possible in OSX.