diff --git a/src/node/api_clients/rest.py b/src/node/api_clients/rest.py index daaedd0c..5ef37e3e 100644 --- a/src/node/api_clients/rest.py +++ b/src/node/api_clients/rest.py @@ -25,8 +25,8 @@ class REST(BaseClient): return info_response.json() def health(self): - health_response = self.rest_call_text("get", "health") - return health_response.text() + health_response = self.rest_call("get", "health") + return health_response.json() def get_peers(self): get_peers_response = self.rest_call("get", "admin/v1/peers") diff --git a/src/node/waku_node.py b/src/node/waku_node.py index 919d20cd..d41378d0 100644 --- a/src/node/waku_node.py +++ b/src/node/waku_node.py @@ -188,17 +188,24 @@ class WakuNode: def ensure_ready(self, timeout_duration=10): @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True) + def check_healthy(node=self): + self.health_response = node.health() + h = json.loads(self.health_response) + if h["nodeHealth"] and h["nodeHealth"] != "Ready": + raise AssertionError("Waiting for the node health status: Ready") + + if h["protocolsHealth"] and h["protocolsHealth"]["Rln Relay"] != "Ready": + raise AssertionError("Waiting for the Rln Relay status: Ready") + logger.info("Node protocols are initialized !!") + + @retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True) def check_ready(node=self): node.info_response = node.info() logger.info("REST service is ready !!") + check_healthy() check_ready() - @retry(stop=stop_after_delay(10), wait=wait_fixed(1), reraise=True) - def ensure_healthy(self): - self.health_response = self.health() - logger.info("Node is healthy !!") - def get_enr_uri(self): try: return self.info_response["enrUri"] diff --git a/tests/relay/test_rln.py b/tests/relay/test_rln.py index 4cf38972..c4444e91 100644 --- a/tests/relay/test_rln.py +++ b/tests/relay/test_rln.py @@ -104,7 +104,6 @@ class TestRelayRLN(StepsRLN, StepsRelay): failed_payloads.append(payload["description"]) assert not failed_payloads, f"Payloads failed: {failed_payloads}" - @pytest.mark.skip(reason="exceeding timeout, waiting for https://github.com/waku-org/nwaku/pull/2612 to be part of the release") @pytest.mark.timeout(600) def test_valid_payloads_dynamic_at_slow_rate(self): self.setup_main_rln_relay_nodes(rln_relay_dynamic="true", wait_for_node_sec=600)