Antoine Poinsot 6d498db5e5
Merge #1034: Prepare v5 release
2dc8cb0d422d2f601c8662df71651c596d15ae36 README: add Coldcard as supported signing device (Antoine Poinsot)
abf15fea3c15ca5f0005417a1490e057d40e6c6b CHANGELOG: release notes for v5 (Antoine Poinsot)
b5c2375d0bb6bef6cd2f0d7534c303fe71118105 doc: update the signing devices compatibility documentation (Antoine Poinsot)
d9337121abe486389514c7b2336e39d2a1f0c8de Bump Liana version (Antoine Poinsot)
de05460ad01145df9bbf63ec58932a72dd1a14d3 doc/BUILD.md: correct MSRV (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  darosior:
    self-ACK 2dc8cb0d422d2f601c8662df71651c596d15ae36 -- not code

Tree-SHA512: b84ea6dabf3ff41ac9b61c6ee8ef7cbbdb5942d13bff83b70e60c93e2f61a14db164b7987129cfde5fd59a667297e2832458f62f0e979d949667d0cc2c168f37
2024-03-25 16:33:51 +01:00
..
2024-03-22 16:42:33 +01:00

Lianad blackbox tests

Here we test lianad by starting it on a regression testing Bitcoin network, and by then talking to it as an user would, from the outside.

Python scripts are used for the automation, and specifically the pytest framework.

Credits: this test framework was taken and adapted from revaultd, which was itself adapted from C-lightning's test framework.

Building the project for testing

To run the tests, we must build the debug version of lianad. Follow the instructions at doc/BUILD.md but instead of running

$ cargo build --release

Run

$ cargo build

to build the daemon for testing.
The lianad and liana-cli binaries will be in the target/debug directory at the root of the repository.

Test dependencies

Functional tests dependencies can be installed using pip. Use a virtual environment.

# Create a new virtual environment, preferably.
python3 -m venv venv
. venv/bin/activate
# Get the deps
pip install -r tests/requirements.txt

Additionaly you need to have bitcoind installed on your computer, please refer to bitcoincore for installation. You may use a specific bitcoind binary by specifying the BITCOIND_PATH env var.

Running the tests

From the root of the repository:

pytest tests/

For running the tests under Taproot a bitcoind version 26.0 or superior must be used. It can be pointed to using the BITCOIND_PATH variable. For now, one must also compile the taproot_signer Rust program:

(cd tests/tools/taproot_signer && cargo build --release)

Then the test suite can be run by using Taproot descriptors instead of P2WSH descriptors by setting the USE_TAPROOT environment variable to 1.

Tips and tricks

Logging

We use the Live Logging functionality from pytest. It is configured in (pyproject.toml)[../pyproject.toml] to output INFO-level to the console. If a test fails, the entire DEBUG log is output.

You can override the config at runtime with the --log-cli-level option:

pytest -vvv --log-cli-level=DEBUG -k test_startup

Note that we record all logs from daemons, and we start them with log_level = "debug".

Test lints

Just use black.

More

See the environment variables in test_framework/utils.py.