2
2
3
3
import os
4
4
from pathlib import Path
5
- from subprocess import PIPE , Popen
6
5
7
6
import requests
8
7
from test_base import TestBase
@@ -30,21 +29,14 @@ def check_fork_observer(self):
30
29
self .log .info ("Creating chain split" )
31
30
self .warnet ("bitcoin rpc john createwallet miner" )
32
31
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
42
33
43
34
def call_fo_api ():
35
+ fo_root = "http://localhost:2019/fork-observer"
44
36
try :
45
- fo_res = requests .get ("http://localhost:2323 /api/networks.json" )
37
+ fo_res = requests .get (f" { fo_root } /api/networks.json" )
46
38
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" )
48
40
# fork observed!
49
41
return len (fo_data .json ()["header_infos" ]) == 2
50
42
except Exception as e :
@@ -54,7 +46,6 @@ def call_fo_api():
54
46
55
47
self .wait_for_predicate (call_fo_api )
56
48
self .log .info ("Fork observed!" )
57
- self .fo_port_fwd_process .terminate ()
58
49
59
50
60
51
if __name__ == "__main__" :
0 commit comments