test: add scenario 'regtest'
This commit is contained in:
parent
1f96ca67c5
commit
9951f10e74
@ -181,6 +181,7 @@ all() {
|
|||||||
scenario=default buildTest "$@"
|
scenario=default buildTest "$@"
|
||||||
scenario=netns buildTest "$@"
|
scenario=netns buildTest "$@"
|
||||||
scenario=full buildTest "$@"
|
scenario=full buildTest "$@"
|
||||||
|
scenario=regtest buildTest "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
@ -120,6 +120,38 @@ let testEnv = rec {
|
|||||||
tests.backups = mkForce false;
|
tests.backups = mkForce false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# All regtest-enabled services
|
||||||
|
regtest = {
|
||||||
|
imports = [ scenarios.regtestBase ];
|
||||||
|
services.clightning.enable = true;
|
||||||
|
services.spark-wallet.enable = true;
|
||||||
|
services.lnd.enable = true;
|
||||||
|
services.lightning-loop.enable = true;
|
||||||
|
services.electrs.enable = true;
|
||||||
|
services.btcpayserver.enable = true;
|
||||||
|
services.joinmarket.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
regtestBase = {
|
||||||
|
tests.regtest = true;
|
||||||
|
|
||||||
|
services.bitcoind.regtest = true;
|
||||||
|
systemd.services.bitcoind.postStart = mkAfter ''
|
||||||
|
cli=${config.services.bitcoind.cli}/bin/bitcoin-cli
|
||||||
|
address=$($cli getnewaddress)
|
||||||
|
$cli generatetoaddress 10 $address
|
||||||
|
'';
|
||||||
|
|
||||||
|
# lightning-loop contains no builtin swap server for regtest.
|
||||||
|
# Add a dummy definition.
|
||||||
|
services.lightning-loop.extraConfig = ''
|
||||||
|
server.host=localhost
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Needs wallet support which is unavailable for regtest
|
||||||
|
services.joinmarket.yieldgenerator.enable = mkForce false;
|
||||||
|
};
|
||||||
|
|
||||||
## Examples / debug helper
|
## Examples / debug helper
|
||||||
|
|
||||||
# Run a selection of tests in scenario 'netns'
|
# Run a selection of tests in scenario 'netns'
|
||||||
|
@ -326,6 +326,27 @@ def _():
|
|||||||
assert_no_failure("bitcoind-import-banlist")
|
assert_no_failure("bitcoind-import-banlist")
|
||||||
|
|
||||||
|
|
||||||
|
@test("regtest")
|
||||||
|
def _():
|
||||||
|
if "electrs" in enabled_tests:
|
||||||
|
machine.wait_until_succeeds(log_has_string("electrs", "BlockchainInfo"))
|
||||||
|
get_block_height_cmd = (
|
||||||
|
"""echo '{"method": "blockchain.headers.subscribe", "id": 0, "params": []}'"""
|
||||||
|
f" | nc -N {ip('electrs')} 50001 | jq -M .result.height"
|
||||||
|
)
|
||||||
|
assert_full_match(get_block_height_cmd, "10\n")
|
||||||
|
if "clightning" in enabled_tests:
|
||||||
|
machine.wait_until_succeeds(
|
||||||
|
"[[ $(sudo -u operator lightning-cli getinfo | jq -M .blockheight) == 10 ]]"
|
||||||
|
)
|
||||||
|
if "lnd" in enabled_tests:
|
||||||
|
machine.wait_until_succeeds(
|
||||||
|
"[[ $(sudo -u operator lncli getinfo | jq -M .block_height) == 10 ]]"
|
||||||
|
)
|
||||||
|
if "lightning-loop" in enabled_tests:
|
||||||
|
machine.wait_until_succeeds(log_has_string("lightning-loop", "Connected to lnd node"))
|
||||||
|
|
||||||
|
|
||||||
if "netns-isolation" in enabled_tests:
|
if "netns-isolation" in enabled_tests:
|
||||||
|
|
||||||
def ip(name):
|
def ip(name):
|
||||||
|
Loading…
Reference in New Issue
Block a user