Antoine Poinsot aa415570b8
Merge #393: Backward compat functional test
6cc4efd303bb5e5cc5a1d50a4925428429f93ab9 ci: run the backward compat functional test (Antoine Poinsot)
96ff447fc98d50f72142abe1f1619bade768c8ec tests: add a datadir migration functional test (Antoine Poinsot)

Pull request description:

  Based off #392.

  This introduces a backward-compatibility functional test. For now it really is targeted at testing the DB migration from 0.3 to the upcoming 0.4, but the concept is also useful more generally to automatically test backward compatibility between our releases.

ACKs for top commit:
  darosior:
    self-ACK 6cc4efd

Tree-SHA512: cb52a5de2de73d1e5b0bce51bbc7f586b63e1b67fdd95026be09134ab764d047ab33f0965f28700a2fef13108e9637937860edac03c49a7392f0cd71c3d03657
2023-04-06 14:02:17 +02:00
..
2022-11-17 17:10:22 +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.

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/

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.