Skip to content

Commit

Permalink
tests: add tests for trustedcoin clightning plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm committed Mar 18, 2023
1 parent 0c40f51 commit 135008e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion test/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -315,6 +315,16 @@ let
services.lnd.enable = true;
services.bitcoind.prune = 1000;
};

# Test the special clightning setup where trustedcoin plugin is used
trustedcoin = {
tests.cligtning = mkForce false;
tests.trustedcoin = true;
services.clightning = {
enable = true;
plugins.trustedcoin.enable = true;
};
};
} // (import ../dev/dev-scenarios.nix {
inherit lib scenarios;
});
Expand Down
12 changes: 12 additions & 0 deletions test/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,18 @@ def get_block_height(ip, port):
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"]
Expand Down

0 comments on commit 135008e

Please sign in to comment.