diff --git a/.travis.yml b/.travis.yml index 6fb6f38..d2806e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,10 @@ env: - PKG=elementsd STABLE=0 - PKG=electrs STABLE=1 - PKG=electrs STABLE=0 + - PKG=nbxplorer STABLE=1 + - PKG=nbxplorer STABLE=0 + - PKG=btcpayserver STABLE=1 + - PKG=btcpayserver STABLE=0 - PKG=liquid-swap STABLE=1 - PKG=lightning-loop STABLE=0 - PKG=nixops19_09 STABLE=1 diff --git a/test/base.py b/test/base.py index 9950d56..d250eb2 100644 --- a/test/base.py +++ b/test/base.py @@ -84,6 +84,13 @@ def run_tests(extra_tests): ) ) + assert_running("nbxplorer") + machine.wait_until_succeeds(log_has_string("nbxplorer", "BTC: RPC connection successful")) + extra_tests.pop("nbxplorer")() + assert_running("btcpayserver") + machine.wait_until_succeeds(log_has_string("btcpayserver", "Listening on")) + extra_tests.pop("btcpayserver")() + assert_running("spark-wallet") extra_tests.pop("spark-wallet")() diff --git a/test/scenarios/default.py b/test/scenarios/default.py index dbea1e3..e5c1eb0 100644 --- a/test/scenarios/default.py +++ b/test/scenarios/default.py @@ -2,6 +2,19 @@ def electrs(): machine.wait_for_open_port(4224) # prometeus metrics provider +def nbxplorer(): + machine.wait_for_open_port(24444) + + +def btcpayserver(): + machine.wait_for_open_port(23000) + # test lnd custom macaroon + assert_matches( + 'sudo -u btcpayserver curl -s --cacert /secrets/lnd-cert --header "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 /run/lnd/btcpayserver.macaroon)" -X GET https://127.0.0.1:8080/v1/getinfo | jq', + '"version"', + ) + + def spark_wallet(): machine.wait_for_open_port(9737) spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1] @@ -31,6 +44,8 @@ def prestop(): extra_tests = { "electrs": electrs, + "nbxplorer": nbxplorer, + "btcpayserver": btcpayserver, "spark-wallet": spark_wallet, "lightning-charge": lightning_charge, "nanopos": nanopos, diff --git a/test/scenarios/withnetns.py b/test/scenarios/withnetns.py index 6b5df81..5f3be5a 100644 --- a/test/scenarios/withnetns.py +++ b/test/scenarios/withnetns.py @@ -10,6 +10,8 @@ nanopos_ip = "169.254.1.19" recurringdonations_ip = "169.254.1.20" nginx_ip = "169.254.1.21" lightningloop_ip = "169.254.1.22" +nbxplorer_ip = "169.254.1.23" +btcpayserver_ip = "169.254.1.24" def electrs(): @@ -18,6 +20,20 @@ def electrs(): ) # prometeus metrics provider +def nbxplorer(): + machine.wait_until_succeeds("ip netns exec nb-nbxplorer nc -z %s 24444" % nbxplorer_ip) + + +def btcpayserver(): + machine.wait_until_succeeds("ip netns exec nb-btcpayserver nc -z %s 23000" % btcpayserver_ip) + # test lnd custom macaroon + assert_matches( + 'ip netns exec nb-btcpayserver sudo -u btcpayserver curl -s --cacert /secrets/lnd-cert --header "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 /run/lnd/btcpayserver.macaroon)" -X GET https://%s:8080/v1/getinfo | jq' + % lnd_ip, + '"version"', + ) + + def spark_wallet(): machine.wait_until_succeeds("ip netns exec nb-spark-wallet nc -z %s 9737" % sparkwallet_ip) spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1] @@ -50,6 +66,7 @@ def web_index(): def prestop(): ping_bitcoind = "ip netns exec nb-bitcoind ping -c 1 -w 1" ping_nanopos = "ip netns exec nb-nanopos ping -c 1 -w 1" + ping_nbxplorer = "ip netns exec nb-nbxplorer ping -c 1 -w 1" # Positive ping tests (non-exhaustive) machine.succeed( @@ -57,6 +74,8 @@ def prestop(): + "%s %s &&" % (ping_bitcoind, clightning_ip) + "%s %s &&" % (ping_bitcoind, lnd_ip) + "%s %s &&" % (ping_bitcoind, liquidd_ip) + + "%s %s &&" % (ping_bitcoind, nbxplorer_ip) + + "%s %s &&" % (ping_nbxplorer, btcpayserver_ip) + "%s %s &&" % (ping_nanopos, lightningcharge_ip) + "%s %s &&" % (ping_nanopos, nanopos_ip) + "%s %s" % (ping_nanopos, nginx_ip) @@ -77,7 +96,8 @@ def prestop(): + "%s %s ||" % (ping_nanopos, liquidd_ip) + "%s %s ||" % (ping_nanopos, electrs_ip) + "%s %s ||" % (ping_nanopos, sparkwallet_ip) - + "%s %s" % (ping_nanopos, recurringdonations_ip) + + "%s %s ||" % (ping_nanopos, recurringdonations_ip) + + "%s %s" % (ping_nanopos, btcpayserver_ip) ) # test that netns-exec can't be run for unauthorized namespace @@ -94,6 +114,8 @@ def prestop(): extra_tests = { "electrs": electrs, + "nbxplorer": nbxplorer, + "btcpayserver": btcpayserver, "spark-wallet": spark_wallet, "lightning-charge": lightning_charge, "nanopos": nanopos, diff --git a/test/test.nix b/test/test.nix index 5de981b..86252b3 100644 --- a/test/test.nix +++ b/test/test.nix @@ -52,6 +52,11 @@ import ./make-test.nix rec { services.backups.enable = true; + services.btcpayserver.enable = true; + services.btcpayserver.lightningBackend = "lnd"; + # needed to test macaroon creation + environment.systemPackages = with pkgs; [ openssl xxd ]; + # to test that unused secrets are made inaccessible by 'setup-secrets' systemd.services.generate-secrets.postStart = '' install -o nobody -g nogroup -m777 <(:) /secrets/dummy