13398982534d56a5723dfa86723c5917483c8653 commands: include missing amount in response (jp1ac4) Pull request description: This PR follows a discussion around https://github.com/wizardsardine/liana/pull/873#issuecomment-1886715468. The GUI uses the `InsufficientFunds` error to get the missing amount when the user is creating a new spend, but it is not straightforward to extract this information in a general way from the RPC error (see https://github.com/wizardsardine/liana/issues/822#issuecomment-1836482355) and instead the spend module's `create_spend` is currently used (see https://github.com/wizardsardine/liana/pull/863). With this PR, the missing amount will be included in the `createspend` response rather than as an error. These changes are based on suggestions from @darosior and @edouardparis. In a follow-up PR, the GUI should revert to using the `createspend` command to calculate the amount left to select. ACKs for top commit: darosior: re-ACK 1339898 Tree-SHA512: bf702d6b355339e96e719c1d95824e7941ac4fbaece4ec4cccd00b56ea4683ce7fb0cefc43faa5731b57e7935ef99da3a2c73b84aaeb9fa5f67703c799be2196
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/
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.