From eef07c15683607167a7e6a68631b38cac80732cc Mon Sep 17 00:00:00 2001 From: leoporoli Date: Wed, 26 Apr 2023 11:12:12 -0300 Subject: [PATCH] refactor: added custom port wait config for lighthouse validator (#89) --- .../cl/lighthouse/lighthouse_launcher.star | 3 ++- src/shared_utils/shared_utils.star | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/participant_network/cl/lighthouse/lighthouse_launcher.star b/src/participant_network/cl/lighthouse/lighthouse_launcher.star index c4a95bdce..9728d69b6 100644 --- a/src/participant_network/cl/lighthouse/lighthouse_launcher.star +++ b/src/participant_network/cl/lighthouse/lighthouse_launcher.star @@ -37,6 +37,7 @@ VALIDATOR_HTTP_PORT_ID = "http" VALIDATOR_METRICS_PORT_ID = "metrics" VALIDATOR_HTTP_PORT_NUM = 5042 VALIDATOR_METRICS_PORT_NUM = 5064 +VALIDATOR_HTTP_PORT_WAIT_TIMEOUT = "6m" METRICS_PATH = "/metrics" @@ -53,7 +54,7 @@ BEACON_USED_PORTS = { } VALIDATOR_USED_PORTS = { - VALIDATOR_HTTP_PORT_ID: shared_utils.new_port_spec(VALIDATOR_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL), + VALIDATOR_HTTP_PORT_ID: shared_utils.new_port_spec(VALIDATOR_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.NOT_PROVIDED_APPLICATION_PROTOCOL, VALIDATOR_HTTP_PORT_WAIT_TIMEOUT), VALIDATOR_METRICS_PORT_ID: shared_utils.new_port_spec(VALIDATOR_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL), } diff --git a/src/shared_utils/shared_utils.star b/src/shared_utils/shared_utils.star index dc834b49a..02b78a377 100644 --- a/src/shared_utils/shared_utils.star +++ b/src/shared_utils/shared_utils.star @@ -2,6 +2,7 @@ TCP_PROTOCOL = "TCP" UDP_PROTOCOL = "UDP" HTTP_APPLICATION_PROTOCOL = "http" NOT_PROVIDED_APPLICATION_PROTOCOL = "" +NOT_PROVIDED_WAIT = "not-provided-wait" def new_template_and_data(template, template_data_json): return struct(template = template, data = template_data_json) @@ -24,5 +25,8 @@ def path_dir(path): return "/".join(split_path) or "/" -def new_port_spec(number, transport_protocol, application_protocol= NOT_PROVIDED_APPLICATION_PROTOCOL): - return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol=application_protocol) +def new_port_spec(number, transport_protocol, application_protocol = NOT_PROVIDED_APPLICATION_PROTOCOL, wait = NOT_PROVIDED_WAIT): + if (wait == NOT_PROVIDED_WAIT): + return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol = application_protocol) + + return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol = application_protocol, wait = wait)