From xx network wiki
Jump to navigation Jump to search
This is a team contributed page

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.

  1. 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:

    • elixxir/primitives
    • elixxir/crypto
    • elixxir/comms
    • elixxir/gpumathsgo
    • elixxir/server
    • elixxir/gateway
    • elixxir/client
    • elixxir/user-discovery-bot
    • elixxir/LocalEnvironment
    • elixxir/integration
    • elixxir/wrapper
    • xx_network/primitives
    • xx_network/crypto
    • xx_network/comms
  2. Use git clone or any other method to download the repository.

    In the following steps, Primitives will be used as an example.

  3. Change directories to the root of the downloaded repository.

  4. 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.

  5. To run tests located in a specific directory, include the directory name. Also, including the -v flag 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.

  6. To run only one test or multiple tests matching a regular expression, use the -run flag.