fulcrum: add module

This commit is contained in:
Erik Arvstedt 2022-07-04 12:15:44 +02:00
parent edd8bd311c
commit 7d7f2df006
No known key found for this signature in database
GPG key ID: 33312B944DD97846
11 changed files with 190 additions and 7 deletions

View file

@ -95,6 +95,9 @@ let
tests.electrs = cfg.electrs.enable;
services.fulcrum.port = 50002;
tests.fulcrum = cfg.fulcrum.enable;
tests.liquidd = cfg.liquidd.enable;
services.liquidd.extraConfig = mkIf config.test.noConnections "connect=0";
@ -182,6 +185,7 @@ let
services.lightning-pool.enable = true;
services.charge-lnd.enable = true;
services.electrs.enable = true;
services.fulcrum.enable = true;
services.liquidd.enable = true;
services.btcpayserver.enable = true;
services.joinmarket.enable = true;
@ -228,6 +232,7 @@ let
services.lightning-pool.enable = true;
services.charge-lnd.enable = true;
services.electrs.enable = true;
services.fulcrum.enable = true;
services.btcpayserver.enable = true;
services.joinmarket.enable = true;
};

View file

@ -110,6 +110,11 @@ def _():
log_has_string("electrs", "waiting for 0 blocks to download")
)
@test("fulcrum")
def _():
assert_running("fulcrum")
machine.wait_until_succeeds(log_has_string("fulcrum", "started ok"))
# Impure: Stops electrs
# Stop electrs from spamming the test log with 'waiting for 0 blocks to download' messages
@test("stop-electrs")
@ -383,33 +388,44 @@ def _():
else:
return False
def get_block_height(ip, port):
return (
"""echo '{"method": "blockchain.headers.subscribe", "id": 0}'"""
f" | nc {ip} {port} | head -1 | jq -M .result.height"
)
num_blocks = test_data["num_blocks"]
if enabled("electrs"):
machine.wait_until_succeeds(log_has_string("electrs", "serving Electrum RPC"))
get_block_height_cmd = (
"""echo '{"method": "blockchain.headers.subscribe", "id": 0, "params": []}'"""
f" | nc {ip('electrs')} 50001 | head -1 | jq -M .result.height"
)
assert_full_match(get_block_height_cmd, f"{num_blocks}\n")
assert_full_match(get_block_height(ip('electrs'), 50001), f"{num_blocks}\n")
if enabled("fulcrum"):
machine.wait_until_succeeds(log_has_string("fulcrum", "listening for connections"))
assert_full_match(get_block_height(ip('fulcrum'), 50002), f"{num_blocks}\n")
if enabled("clightning"):
machine.wait_until_succeeds(
f"[[ $(runuser -u operator -- lightning-cli getinfo | jq -M .blockheight) == {num_blocks} ]]"
)
if enabled("lnd"):
machine.wait_until_succeeds(
f"[[ $(runuser -u operator -- lncli getinfo | jq -M .block_height) == {num_blocks} ]]"
)
if enabled("lightning-loop"):
machine.wait_until_succeeds(
log_has_string("lightning-loop", f"Starting event loop at height {num_blocks}")
)
succeed("runuser -u operator -- loop getparams")
if enabled("lightning-pool"):
machine.wait_until_succeeds(
log_has_string("lightning-pool", "lnd is now fully synced to its chain backend")
)
succeed("runuser -u operator -- pool orders list")
if enabled("btcpayserver"):
machine.wait_until_succeeds(log_has_string("nbxplorer", f"At height: {num_blocks}"))