btcpayserver: add tests
This commit is contained in:
parent
f93c3c8405
commit
c9c844de80
|
@ -27,6 +27,10 @@ env:
|
||||||
- PKG=elementsd STABLE=0
|
- PKG=elementsd STABLE=0
|
||||||
- PKG=electrs STABLE=1
|
- PKG=electrs STABLE=1
|
||||||
- PKG=electrs STABLE=0
|
- 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=liquid-swap STABLE=1
|
||||||
- PKG=lightning-loop STABLE=0
|
- PKG=lightning-loop STABLE=0
|
||||||
- PKG=nixops19_09 STABLE=1
|
- PKG=nixops19_09 STABLE=1
|
||||||
|
|
|
@ -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")
|
assert_running("spark-wallet")
|
||||||
extra_tests.pop("spark-wallet")()
|
extra_tests.pop("spark-wallet")()
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,19 @@ def electrs():
|
||||||
machine.wait_for_open_port(4224) # prometeus metrics provider
|
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():
|
def spark_wallet():
|
||||||
machine.wait_for_open_port(9737)
|
machine.wait_for_open_port(9737)
|
||||||
spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1]
|
spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1]
|
||||||
|
@ -31,6 +44,8 @@ def prestop():
|
||||||
|
|
||||||
extra_tests = {
|
extra_tests = {
|
||||||
"electrs": electrs,
|
"electrs": electrs,
|
||||||
|
"nbxplorer": nbxplorer,
|
||||||
|
"btcpayserver": btcpayserver,
|
||||||
"spark-wallet": spark_wallet,
|
"spark-wallet": spark_wallet,
|
||||||
"lightning-charge": lightning_charge,
|
"lightning-charge": lightning_charge,
|
||||||
"nanopos": nanopos,
|
"nanopos": nanopos,
|
||||||
|
|
|
@ -10,6 +10,8 @@ nanopos_ip = "169.254.1.19"
|
||||||
recurringdonations_ip = "169.254.1.20"
|
recurringdonations_ip = "169.254.1.20"
|
||||||
nginx_ip = "169.254.1.21"
|
nginx_ip = "169.254.1.21"
|
||||||
lightningloop_ip = "169.254.1.22"
|
lightningloop_ip = "169.254.1.22"
|
||||||
|
nbxplorer_ip = "169.254.1.23"
|
||||||
|
btcpayserver_ip = "169.254.1.24"
|
||||||
|
|
||||||
|
|
||||||
def electrs():
|
def electrs():
|
||||||
|
@ -18,6 +20,20 @@ def electrs():
|
||||||
) # prometeus metrics provider
|
) # 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():
|
def spark_wallet():
|
||||||
machine.wait_until_succeeds("ip netns exec nb-spark-wallet nc -z %s 9737" % sparkwallet_ip)
|
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]
|
spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1]
|
||||||
|
@ -50,6 +66,7 @@ def web_index():
|
||||||
def prestop():
|
def prestop():
|
||||||
ping_bitcoind = "ip netns exec nb-bitcoind ping -c 1 -w 1"
|
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_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)
|
# Positive ping tests (non-exhaustive)
|
||||||
machine.succeed(
|
machine.succeed(
|
||||||
|
@ -57,6 +74,8 @@ def prestop():
|
||||||
+ "%s %s &&" % (ping_bitcoind, clightning_ip)
|
+ "%s %s &&" % (ping_bitcoind, clightning_ip)
|
||||||
+ "%s %s &&" % (ping_bitcoind, lnd_ip)
|
+ "%s %s &&" % (ping_bitcoind, lnd_ip)
|
||||||
+ "%s %s &&" % (ping_bitcoind, liquidd_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, lightningcharge_ip)
|
||||||
+ "%s %s &&" % (ping_nanopos, nanopos_ip)
|
+ "%s %s &&" % (ping_nanopos, nanopos_ip)
|
||||||
+ "%s %s" % (ping_nanopos, nginx_ip)
|
+ "%s %s" % (ping_nanopos, nginx_ip)
|
||||||
|
@ -77,7 +96,8 @@ def prestop():
|
||||||
+ "%s %s ||" % (ping_nanopos, liquidd_ip)
|
+ "%s %s ||" % (ping_nanopos, liquidd_ip)
|
||||||
+ "%s %s ||" % (ping_nanopos, electrs_ip)
|
+ "%s %s ||" % (ping_nanopos, electrs_ip)
|
||||||
+ "%s %s ||" % (ping_nanopos, sparkwallet_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
|
# test that netns-exec can't be run for unauthorized namespace
|
||||||
|
@ -94,6 +114,8 @@ def prestop():
|
||||||
|
|
||||||
extra_tests = {
|
extra_tests = {
|
||||||
"electrs": electrs,
|
"electrs": electrs,
|
||||||
|
"nbxplorer": nbxplorer,
|
||||||
|
"btcpayserver": btcpayserver,
|
||||||
"spark-wallet": spark_wallet,
|
"spark-wallet": spark_wallet,
|
||||||
"lightning-charge": lightning_charge,
|
"lightning-charge": lightning_charge,
|
||||||
"nanopos": nanopos,
|
"nanopos": nanopos,
|
||||||
|
|
|
@ -52,6 +52,11 @@ import ./make-test.nix rec {
|
||||||
|
|
||||||
services.backups.enable = true;
|
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'
|
# to test that unused secrets are made inaccessible by 'setup-secrets'
|
||||||
systemd.services.generate-secrets.postStart = ''
|
systemd.services.generate-secrets.postStart = ''
|
||||||
install -o nobody -g nogroup -m777 <(:) /secrets/dummy
|
install -o nobody -g nogroup -m777 <(:) /secrets/dummy
|
||||||
|
|
Loading…
Reference in New Issue
Block a user