test: use internal ports

This commit is contained in:
Roman 2025-01-07 21:08:41 +08:00
parent 54f91fd5b7
commit 22f72be241
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
2 changed files with 11 additions and 16 deletions

View File

@ -20,7 +20,6 @@ class REST(BaseClient):
headers = {"accept": "text/plain"}
return self.make_request(method, url, headers=headers, data=payload)
def status(self):
status_response = self.rest_call("get", "cl/status")
logger.debug(f"Status response {status_response}")
def info(self):
status_response = self.rest_call("get", "cryptarchia/info")
return status_response.json()

View File

@ -53,7 +53,7 @@ class NomosNode:
self._external_ports = self._docker_manager.generate_ports(count=number_of_ports)
self._udp_port = self._external_ports[0]
self._tcp_port = self._external_ports[1]
self._api = REST(self._tcp_port)
self._api = REST(self._internal_ports[1])
logger.debug(f"Internal ports {self._internal_ports}")
@ -85,20 +85,16 @@ class NomosNode:
logger.debug(f"Container returned {self._container}")
logger.debug(f"Started container from image {self._image_name}. " f"REST: {getattr(self, '_tcp_port', 'N/A')}")
delay(1)
attached_ip = self._container.attrs["NetworkSettings"]["IPAddress"]
logger.debug(f"Container started with IP {attached_ip}")
# try:
# self.ensure_ready(timeout_duration=wait_for_node_sec)
# except Exception as ex:
# logger.error(f"REST service did not become ready in time: {ex}")
# raise
try:
self.ensure_ready(timeout_duration=wait_for_node_sec)
except Exception as ex:
logger.error(f"REST service did not become ready in time: {ex}")
raise
def ensure_ready(self, timeout_duration=10):
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True)
def check_ready(node=self):
node.info_response = node.status()
node.info_response = node.info()
logger.info("REST service is ready !!")
if self.is_nomos():
@ -107,5 +103,5 @@ class NomosNode:
def is_nomos(self):
return "nomos" in self._container_name
def status(self):
return self._api.status()
def info(self):
return self._api.info()