tests: create run_tests() function in the scenario lib
This commit is contained in:
parent
3d2b366156
commit
6f9349b0a4
@ -1,3 +1,5 @@
|
|||||||
|
run_tests()
|
||||||
|
|
||||||
## electrs
|
## electrs
|
||||||
# the main test body stops electrs
|
# the main test body stops electrs
|
||||||
succeed("systemctl start electrs")
|
succeed("systemctl start electrs")
|
||||||
@ -5,10 +7,12 @@ machine.wait_for_open_port(4224) # prometeus metrics provider
|
|||||||
|
|
||||||
## spark-wallet
|
## 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]
|
||||||
assert_matches(f"curl -s {spark_auth}@localhost:9737", "Spark")
|
assert_matches(f"curl -s {spark_auth}@localhost:9737", "Spark")
|
||||||
|
|
||||||
## lightning-charge
|
## lightning-charge
|
||||||
machine.wait_for_open_port(9112)
|
machine.wait_for_open_port(9112)
|
||||||
|
charge_auth = re.search("API_TOKEN=(.*)", succeed("cat /secrets/lightning-charge-env"))[1]
|
||||||
assert_matches(f"curl -s api-token:{charge_auth}@localhost:9112/info | jq", '"id"')
|
assert_matches(f"curl -s api-token:{charge_auth}@localhost:9112/info | jq", '"id"')
|
||||||
|
|
||||||
## nanopos
|
## nanopos
|
||||||
|
@ -35,6 +35,8 @@ if "is_interactive" in vars():
|
|||||||
|
|
||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
|
|
||||||
|
def run_tests():
|
||||||
assert_running("setup-secrets")
|
assert_running("setup-secrets")
|
||||||
# Unused secrets should be inaccessible
|
# Unused secrets should be inaccessible
|
||||||
succeed('[[ $(stat -c "%U:%G %a" /secrets/dummy) = "root:root 440" ]]')
|
succeed('[[ $(stat -c "%U:%G %a" /secrets/dummy) = "root:root 440" ]]')
|
||||||
@ -68,10 +70,8 @@ assert_running("clightning")
|
|||||||
assert_matches("su operator -c 'lightning-cli getinfo' | jq", '"id"')
|
assert_matches("su operator -c 'lightning-cli getinfo' | jq", '"id"')
|
||||||
|
|
||||||
assert_running("spark-wallet")
|
assert_running("spark-wallet")
|
||||||
spark_auth = re.search("login=(.*)", succeed("cat /secrets/spark-wallet-login"))[1]
|
|
||||||
|
|
||||||
assert_running("lightning-charge")
|
assert_running("lightning-charge")
|
||||||
charge_auth = re.search("API_TOKEN=(.*)", succeed("cat /secrets/lightning-charge-env"))[1]
|
|
||||||
|
|
||||||
assert_running("nanopos")
|
assert_running("nanopos")
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
run_tests()
|
||||||
|
|
||||||
# netns IP addresses
|
# netns IP addresses
|
||||||
bitcoind_ip = "169.254.1.12"
|
bitcoind_ip = "169.254.1.12"
|
||||||
clightning_ip = "169.254.1.13"
|
clightning_ip = "169.254.1.13"
|
||||||
@ -19,12 +21,14 @@ machine.wait_until_succeeds(
|
|||||||
|
|
||||||
## spark-wallet
|
## 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]
|
||||||
assert_matches(
|
assert_matches(
|
||||||
f"ip netns exec nb-spark-wallet curl -s {spark_auth}@%s:9737" % sparkwallet_ip, "Spark"
|
f"ip netns exec nb-spark-wallet curl -s {spark_auth}@%s:9737" % sparkwallet_ip, "Spark"
|
||||||
)
|
)
|
||||||
|
|
||||||
## lightning-charge
|
## lightning-charge
|
||||||
machine.wait_until_succeeds("ip netns exec nb-nanopos nc -z %s 9112" % lightningcharge_ip)
|
machine.wait_until_succeeds("ip netns exec nb-nanopos nc -z %s 9112" % lightningcharge_ip)
|
||||||
|
charge_auth = re.search("API_TOKEN=(.*)", succeed("cat /secrets/lightning-charge-env"))[1]
|
||||||
assert_matches(
|
assert_matches(
|
||||||
f"ip netns exec nb-nanopos curl -s api-token:{charge_auth}@%s:9112/info | jq"
|
f"ip netns exec nb-nanopos curl -s api-token:{charge_auth}@%s:9112/info | jq"
|
||||||
% lightningcharge_ip,
|
% lightningcharge_ip,
|
||||||
|
Loading…
Reference in New Issue
Block a user