22
33import os
44from pathlib import Path
5- from subprocess import PIPE , Popen
65
76import requests
87from test_base import TestBase
@@ -30,21 +29,14 @@ def check_fork_observer(self):
3029 self .log .info ("Creating chain split" )
3130 self .warnet ("bitcoin rpc john createwallet miner" )
3231 self .warnet ("bitcoin rpc john -generate 1" )
33- self .log .info ("Forwarding port 2323..." )
34- # Stays alive in background
35- self .fo_port_fwd_process = Popen (
36- ["kubectl" , "port-forward" , "fork-observer" , "2323" ],
37- stdout = PIPE ,
38- stderr = PIPE ,
39- bufsize = 1 ,
40- universal_newlines = True ,
41- )
32+ # Port will be auto-forwarded by `warnet deploy`, routed through the enabled Caddy pod
4233
4334 def call_fo_api ():
35+ fo_root = "http://localhost:2019/fork-observer"
4436 try :
45- fo_res = requests .get ("http://localhost:2323 /api/networks.json" )
37+ fo_res = requests .get (f" { fo_root } /api/networks.json" )
4638 network_id = fo_res .json ()["networks" ][0 ]["id" ]
47- fo_data = requests .get (f"http://localhost:2323 /api/{ network_id } /data.json" )
39+ fo_data = requests .get (f"{ fo_root } /api/{ network_id } /data.json" )
4840 # fork observed!
4941 return len (fo_data .json ()["header_infos" ]) == 2
5042 except Exception as e :
@@ -54,7 +46,6 @@ def call_fo_api():
5446
5547 self .wait_for_predicate (call_fo_api )
5648 self .log .info ("Fork observed!" )
57- self .fo_port_fwd_process .terminate ()
5849
5950
6051if __name__ == "__main__" :
0 commit comments