Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start local webserver while running tests on long running testnet #2899

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cardano_node_tests/cluster_scripts/testnets/supervisor.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[inet_http_server]
port=127.0.0.1:%%SUPERVISOR_PORT%%
# [inet_http_server]
# port=127.0.0.1:%%SUPERVISOR_PORT%%

[program:relay1]
command=./state-cluster%%INSTANCE_NUM%%/cardano-node-relay1
stderr_logfile=./state-cluster%%INSTANCE_NUM%%/relay1.stderr
stdout_logfile=./state-cluster%%INSTANCE_NUM%%/relay1.stdout
startsecs=5

[program:webserver]
command=python -m http.server --bind 127.0.0.1 %%WEBSERVER_PORT%%
directory=./state-cluster%%INSTANCE_NUM%%/webserver

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

Expand Down
21 changes: 12 additions & 9 deletions cardano_node_tests/utils/cluster_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,22 +525,23 @@ def __init__(self) -> None:

def get_instance_ports(self, instance_num: int) -> InstancePorts:
"""Return ports mapping for given cluster instance."""
offset = (50 + instance_num) * 10
base = 30000 + offset
metrics_base = 30300 + offset
ports_per_instance = 10
offset = instance_num * ports_per_instance
base = configuration.PORTS_BASE + offset
last_port = base + ports_per_instance - 1

relay1_ports = NodePorts(
num=0,
node=base + 1,
ekg=metrics_base + 1,
prometheus=metrics_base + 2,
node=base,
ekg=base + 1,
prometheus=base + 2,
)

ports = InstancePorts(
base=base,
webserver=0,
metrics_submit_api=metrics_base,
submit_api=base + 9,
webserver=last_port,
metrics_submit_api=last_port - 1,
submit_api=last_port - 2,
supervisor=12001 + instance_num,
relay1=relay1_ports.node,
ekg_relay1=relay1_ports.ekg,
Expand Down Expand Up @@ -620,6 +621,8 @@ def _reconfigure_testnet(
new_content = new_content.replace(
"%%PROMETHEUS_PORT_RELAY1%%", str(instance_ports.prometheus_relay1)
)
# Reconfigure webserver port
new_content = new_content.replace("%%WEBSERVER_PORT%%", str(instance_ports.webserver))

with open(outfile, "w", encoding="utf-8") as out_fp:
out_fp.write(new_content)
Expand Down
Loading