Skip to content

Commit 48acdde

Browse files
committed
test fork-observer access via caddy dashboard
1 parent 4879b03 commit 48acdde

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

test/data/services/network.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ nodes:
3333
rpcwhitelistdefault=0
3434
fork_observer:
3535
enabled: true
36+
caddy:
37+
enabled: true

test/services_test.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44
from pathlib import Path
5-
from subprocess import PIPE, Popen
65

76
import requests
87
from 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

6051
if __name__ == "__main__":

0 commit comments

Comments
 (0)