This repository contains tests for RGB.
- Linux OS
- Docker with its
compose
plugin - Rust
Clone the project, including submodules:
git clone https://github.com/RGB-WG/rgb-tests --recurse-submodules
Note: after checking out to another commit, remember to run:
git submodule update
Then, from the project root, run the tests by running:
cargo test
--test-threads
option
(e.g. cargo test -- --test-threads=8
).
Test services will be automatically (re)started by the test command and will run in docker containers. If you don't have the docker images they will be automatically pulled. Note that in this case the first test execution will be slower. Also note that there's no automatic shutdown of test services, you'll need to manually remove the docker containers with:
docker compose -f tests/docker-compose.yml --profile='*' down -v --remove-orphans
The indexer used by the tests is configurable, currently esplora and electrum
are supported. You can change the indexer type by setting the INDEXER
environment variable, for example:
INDEXER=esplora cargo test # default
INDEXER=electrum cargo test
If you are developing new tests and want a faster execution, you can set
SKIP_INIT=1
to avoid restarting the test services. Please note that you
cannot switch to another indexer when using this option, you'll have to use the
same indexer type from the previous test execution.
To run the tests and generate a code coverage report run:
./tests/coverage.sh
This will generate a report in target/llvm-cov/html/index.html
that you can
visualize on a browser (e.g. firefox target/llvm-cov/html/index.html
).
Coverage will be measured for all patched crates.
The GitHub organizations of submodule repositories are: