A majority of the code in the Elixxir codebase is tested. Node operators can run the tests on any Elixxir or xx network public repository themselves using the instructions in this section.
Running tests in Go for most Elixxir and xx network repositories is a straightforward process. But first, make sure to follow the Go Environment Set Up. Then, to run a test, download a repository and use go test.
Go to the Elixxir or xx network GitLab page and select a repository to download. Alternatively, select one from the following list of public repositories:
git cloneor any other method to download the repository.
In the following steps, Primitives will be used as an example.
Change directories to the root of the downloaded repository.
To compile and run all the tests for this repository, use the following command.The first time the code is compiled, all of the dependencies will download first.
Running the tests can take a while, but once they are finished, a summary of the tests and their elapsed time will be printed out. If any tests fail, those errors will be printed too.
To run tests located in a specific directory, include the directory name. Also, including the
-vflag will print more details about which test is being run and the debug logs.
The result will be a list of the tests run and their elapsed time. At the bottom is the total time for all the tests.
To run only one test or multiple tests matching a regular expression, use the