11#!/usr/bin/env python3
22
3+ import json
34import os
45from pathlib import Path
56
@@ -33,14 +34,14 @@ def check_fork_observer(self):
3334 self .warnet ("bitcoin rpc john -generate 1" )
3435 # Port will be auto-forwarded by `warnet deploy`, routed through the enabled Caddy pod
3536
37+ ingress_ip = get_ingress_ip_or_host ()
38+ fo_root = f"http://{ ingress_ip } /fork-observer"
39+
3640 def call_fo_api ():
3741 # if on minikube remember to run `minikube tunnel` for this test to run
38- ingress_ip = get_ingress_ip_or_host ()
39- fo_root = f"http://{ ingress_ip } /fork-observer"
4042 try :
41- fo_res = requests .get (f"{ fo_root } /api/networks.json" )
42- network_id = fo_res .json ()["networks" ][0 ]["id" ]
43- fo_data = requests .get (f"{ fo_root } /api/{ network_id } /data.json" )
43+ # network id is 0xDEADBE in decimal
44+ fo_data = requests .get (f"{ fo_root } /api/14593470/data.json" )
4445 # fork observed!
4546 return len (fo_data .json ()["header_infos" ]) == 2
4647 except Exception as e :
@@ -51,6 +52,19 @@ def call_fo_api():
5152 self .wait_for_predicate (call_fo_api )
5253 self .log .info ("Fork observed!" )
5354
55+ self .log .info ("Checking node description..." )
56+ fo_data = requests .get (f"{ fo_root } /api/14593470/data.json" )
57+ nodes = fo_data .json ()["nodes" ]
58+ assert len (nodes ) == 4
59+ assert nodes [1 ]["name" ] == "john"
60+ assert nodes [1 ]["description" ] == "john.default.svc:18444"
61+
62+ self .log .info ("Checking reachable address is provided..." )
63+ self .warnet ("bitcoin rpc george addnode john.default.svc:18444 onetry" )
64+ self .wait_for_predicate (
65+ lambda : len (json .loads (self .warnet ("bitcoin rpc george getpeerinfo" ))) > 1
66+ )
67+
5468
5569if __name__ == "__main__" :
5670 test = ServicesTest ()
0 commit comments