fix: health endpoint response parsing

This commit is contained in:
Roman 2024-05-07 20:14:48 +08:00
parent c8731b7364
commit 59a079d3a3
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75

View File

@ -190,12 +190,15 @@ class WakuNode:
@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)
h = self.health_response
logger.debug(f"Health endpoint response object {h}")
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")
for p in h["protocolsHealth"]:
if p["Rln Relay"] and p["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)