From 4942130abef3e348208105cf171be72f35604c33 Mon Sep 17 00:00:00 2001 From: Otto Sabart Date: Fri, 3 Mar 2023 21:00:00 +0100 Subject: [PATCH] tests: add tests for trustedcoin clightning plugin --- .cirrus.yml | 1 + test/tests.nix | 11 ++++++++++- test/tests.py | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index fbbf47e..2e3bf31 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,6 +27,7 @@ task: - scenario: default - scenario: netns - scenario: netnsRegtest + - scenario: trustedcoin # This script is run as root build_script: - echo "sandbox = true" >> /etc/nix/nix.conf diff --git a/test/tests.nix b/test/tests.nix index 2501ef6..ba4fa4c 100644 --- a/test/tests.nix +++ b/test/tests.nix @@ -45,7 +45,7 @@ let services.clightning.extraConfig = mkIf config.test.noConnections "disable-dns"; test.data.clightning-plugins = let plugins = config.services.clightning.plugins; - removed = [ "commando" ]; + removed = [ "commando" "trustedcoin" ]; enabled = builtins.filter (plugin: plugins.${plugin}.enable) (subtractLists removed (builtins.attrNames plugins)); nbPkgs = config.nix-bitcoin.pkgs; @@ -315,6 +315,15 @@ let services.lnd.enable = true; services.bitcoind.prune = 1000; }; + + # Test the special clightning setup where trustedcoin plugin is used + trustedcoin = { + tests.trustedcoin = true; + services.clightning = { + enable = true; + plugins.trustedcoin.enable = true; + }; + }; } // (import ../dev/dev-scenarios.nix { inherit lib scenarios; }); diff --git a/test/tests.py b/test/tests.py index 1959c7d..b9795dc 100644 --- a/test/tests.py +++ b/test/tests.py @@ -433,6 +433,18 @@ def _(): if enabled("btcpayserver"): machine.wait_until_succeeds(log_has_string("nbxplorer", f"At height: {num_blocks}")) +@test("trustedcoin") +def _(): + machine.wait_for_unit("bitcoind") + machine.wait_for_unit("clightning") + + # Let's check the trustedcoin plugin was correctly initialized + machine.wait_until_succeeds(log_has_string("clightning", "plugin-trustedcoin[^^]\[0m\s+initialized plugin")) + machine.wait_until_succeeds(log_has_string("clightning", "plugin-trustedcoin[^^]\[0m\s+bitcoind RPC working")) + machine.wait_until_succeeds(log_has_string("clightning", "plugin-trustedcoin[^^]\[0m\s+tip: 0")) + machine.wait_until_succeeds(log_has_string("clightning", "plugin-trustedcoin[^^]\[0m\s+estimatefees error: none of the esploras returned usable responses")) + + if "netns-isolation" in enabled_tests: def ip(name): return test_data["netns"][name]["address"]