Lnd Integration Test Utility
Utility to run a regtest LND process connected to a given bitcoind instance, useful in integration testing environment.
use Conf;
use LndConf;
use BitcoinD;
use Lnd;
// Create a bitcoind instance
let mut bitcoin_conf = default;
let bitcoind = with_conf.unwrap;
let bitcoind = with_conf.unwrap;
let lnd_conf = default;
// Pass the path, conf, and bitcoind
let mut lnd = with_conf;
let mut lnd = with_conf;
let node_info = lnd.client.lightning.get_info.await;
assert!;
Automatic binaries download
In your project Cargo.toml, activate the following features
lnd = { version = "*", features = ["download"] }
To use it:
let bitcoind_exe = downloaded_exe_path.expect;
let bitcoind = new.unwrap;
let lnd_exe = downloaded_exe_path.expect;
let lnd = new.unwrap;
When the LND_DOWNLOAD_ENDPOINT/BITCOIND_DOWNLOAD_ENDPOINT environment variables are set,
lnd/bitcoind will try to download the binaries from the given endpoints.
When you don't use the auto-download feature you have the following options:
- have
lndexecutable in thePATH - provide the
lndexecutable via theLND_EXECenv var
if let Ok = exe_path
Features
- lnd use a temporary directory as db dir
- A free port is asked to the OS (a very low probability race condition is still possible)
- The process is killed when the struct goes out of scope no matter how the test finishes
Thanks to these features every #[test] could easily run isolated with its own environment