diff --git a/cl_config/cfgsync.yaml b/cluster_config/cfgsync.yaml similarity index 100% rename from cl_config/cfgsync.yaml rename to cluster_config/cfgsync.yaml diff --git a/cl_config/scripts/run_cfgsync.sh b/cluster_config/scripts/run_cfgsync.sh similarity index 100% rename from cl_config/scripts/run_cfgsync.sh rename to cluster_config/scripts/run_cfgsync.sh diff --git a/cl_config/scripts/run_nomos_executor.sh b/cluster_config/scripts/run_nomos_executor.sh similarity index 100% rename from cl_config/scripts/run_nomos_executor.sh rename to cluster_config/scripts/run_nomos_executor.sh diff --git a/cl_config/scripts/run_nomos_node.sh b/cluster_config/scripts/run_nomos_node.sh similarity index 100% rename from cl_config/scripts/run_nomos_node.sh rename to cluster_config/scripts/run_nomos_node.sh diff --git a/kzgrs/kzgrs_test_params.bin b/kzgrs/kzgrs_test_params.bin deleted file mode 100644 index ce727bc..0000000 Binary files a/kzgrs/kzgrs_test_params.bin and /dev/null differ diff --git a/src/node/node_vars.py b/src/node/node_vars.py index 0fd27e1..eeed1f0 100644 --- a/src/node/node_vars.py +++ b/src/node/node_vars.py @@ -1,13 +1,13 @@ nomos_nodes = { "nomos": { "image": "nomos:latest", - "volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params.bin:/kzgrs_test_params:z"], + "volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params:/kzgrs_test_params:z"], "ports": ["3000/udp", "18080/tcp"], "entrypoint": "/etc/nomos/scripts/run_nomos_node.sh", }, "nomos_executor": { "image": "nomos:latest", - "volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params.bin:/kzgrs_test_params:z"], + "volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params:/kzgrs_test_params:z"], "ports": ["3000/udp", "18080/tcp"], "entrypoint": "/etc/nomos/scripts/run_nomos_executor.sh", }, diff --git a/src/node/nomos_node.py b/src/node/nomos_node.py index e6b1984..17ff784 100644 --- a/src/node/nomos_node.py +++ b/src/node/nomos_node.py @@ -79,6 +79,45 @@ 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')}") + @retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True) + def stop(self): + if self._container: + logger.debug(f"Stopping container with id {self._container.short_id}") + self._container.stop() + try: + self._container.remove() + except: + pass + self._container = None + logger.debug("Container stopped.") + + @retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True) + def kill(self): + if self._container: + logger.debug(f"Killing container with id {self._container.short_id}") + self._container.kill() + try: + self._container.remove() + except: + pass + self._container = None + logger.debug("Container killed.") + + def restart(self): + if self._container: + logger.debug(f"Restarting container with id {self._container.short_id}") + self._container.restart() + + def pause(self): + if self._container: + logger.debug(f"Pausing container with id {self._container.short_id}") + self._container.pause() + + def unpause(self): + if self._container: + logger.debug(f"Unpause container with id {self._container.short_id}") + self._container.unpause() + 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): diff --git a/tests/e2e/test_2node_alive.py b/tests/e2e/test_2node_alive.py index af0f679..c8e2d01 100644 --- a/tests/e2e/test_2node_alive.py +++ b/tests/e2e/test_2node_alive.py @@ -1,7 +1,6 @@ from src.env_vars import CFGSYNC, NOMOS, NOMOS_EXECUTOR from src.libs.custom_logger import get_custom_logger from src.node.nomos_node import NomosNode -from src.libs.common import delay logger = get_custom_logger(__name__) @@ -24,4 +23,6 @@ class Test2NodeClAlive: logger.error(f"REST service did not become ready in time: {ex}") raise - delay(60) + self.node1.stop() + self.node2.stop() + self.node3.stop()