clightning/feeadjuster: add test

This commit is contained in:
Erik Arvstedt 2022-05-27 11:13:53 +02:00
parent 1054e9a3b1
commit f9315db52c
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
2 changed files with 11 additions and 6 deletions

View File

@ -134,6 +134,7 @@ let
(mkIf config.test.features.clightningPlugins { (mkIf config.test.features.clightningPlugins {
services.clightning.plugins = { services.clightning.plugins = {
clboss.enable = true; clboss.enable = true;
feeadjuster.enable = true;
helpme.enable = true; helpme.enable = true;
monitor.enable = true; monitor.enable = true;
prometheus.enable = true; prometheus.enable = true;

View File

@ -127,20 +127,24 @@ def _():
def _(): def _():
assert_running("clightning") assert_running("clightning")
assert_matches("runuser -u operator -- lightning-cli getinfo | jq", '"id"') assert_matches("runuser -u operator -- lightning-cli getinfo | jq", '"id"')
if test_data["clightning-plugins"]:
enabled_plugins = test_data["clightning-plugins"]
if enabled_plugins:
plugin_list = succeed("lightning-cli plugin list") plugin_list = succeed("lightning-cli plugin list")
plugins = json.loads(plugin_list)["plugins"] plugins = json.loads(plugin_list)["plugins"]
active = set(plugin["name"] for plugin in plugins if plugin["active"]) active = set(plugin["name"] for plugin in plugins if plugin["active"])
failed = set(test_data["clightning-plugins"]).difference(active) failed = set(enabled_plugins).difference(active)
if failed: if failed:
raise Exception( raise Exception(
f"The following clightning plugins are inactive:\n{failed}.\n\n" f"The following clightning plugins are inactive:\n{failed}.\n\n"
f"Output of 'lightning-cli plugin list':\n{plugin_list}" f"Output of 'lightning-cli plugin list':\n{plugin_list}"
) )
else: active = [os.path.splitext(os.path.basename(p))[0] for p in enabled_plugins]
machine.log("Active clightning plugins:") machine.log("\n".join(["Active clightning plugins:", *active]))
for p in test_data["clightning-plugins"]:
machine.log(os.path.basename(p)) if "feeadjuster" in active:
# This is a one-shot service, so this command only succeeds if the service succeeds
succeed("systemctl start clightning-feeadjuster")
@test("lnd") @test("lnd")
def _(): def _():