tests: add extra_tests argument to scenario lib run_tests()

This commit is contained in:
Jonas Nick
2020-08-04 12:17:47 +00:00
parent 6f9349b0a4
commit 5fa0602a18
3 changed files with 81 additions and 50 deletions
+31 -20
View File
@@ -1,25 +1,36 @@
run_tests()
def electrs():
machine.wait_for_open_port(4224) # prometeus metrics provider
## electrs
# the main test body stops electrs
succeed("systemctl start electrs")
machine.wait_for_open_port(4224) # prometeus metrics provider
## spark-wallet
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")
def spark_wallet():
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")
## lightning-charge
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"')
## nanopos
machine.wait_for_open_port(9116)
assert_matches("curl localhost:9116", "tshirt")
def lightning_charge():
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"')
## web index
machine.wait_for_open_port(80)
assert_matches("curl localhost", "nix-bitcoin")
assert_matches("curl -L localhost/store", "tshirt")
def nanopos():
machine.wait_for_open_port(9116)
assert_matches("curl localhost:9116", "tshirt")
def web_index():
machine.wait_for_open_port(80)
assert_matches("curl localhost", "nix-bitcoin")
assert_matches("curl -L localhost/store", "tshirt")
extra_tests = {
"electrs": electrs,
"spark-wallet": spark_wallet,
"lightning-charge": lightning_charge,
"nanopos": nanopos,
"web-index": web_index,
}
run_tests(extra_tests)