mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-02 13:13:08 +00:00
test: stop client nodes after test
This commit is contained in:
parent
6ff8510d61
commit
c4fad7ac84
@ -113,3 +113,6 @@ class NomosCli:
|
||||
@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
|
||||
def kill(self):
|
||||
self._container = kill(self._container)
|
||||
|
||||
def name(self):
|
||||
return self._container_name
|
||||
|
||||
@ -91,8 +91,8 @@ class StepsCommon:
|
||||
delay(5)
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def init_client_nodes(self, request):
|
||||
logger.debug(f"Running fixture init: {inspect.currentframe().f_code.co_name}")
|
||||
def setup_client_nodes(self, request):
|
||||
logger.debug(f"Running fixture setup: {inspect.currentframe().f_code.co_name}")
|
||||
|
||||
if hasattr(request, "param"):
|
||||
num_clients = request.param
|
||||
@ -101,6 +101,5 @@ class StepsCommon:
|
||||
|
||||
for i in range(num_clients):
|
||||
cli_node = NomosCli(command="client_node")
|
||||
cli_node.run()
|
||||
self.client_nodes.append(cli_node)
|
||||
|
||||
delay(1)
|
||||
|
||||
@ -71,6 +71,7 @@ def attach_logs_on_fail(request):
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def close_open_nodes(attach_logs_on_fail):
|
||||
DS.nomos_nodes = []
|
||||
DS.client_nodes = []
|
||||
yield
|
||||
logger.debug(f"Running fixture teardown: {inspect.currentframe().f_code.co_name}")
|
||||
crashed_containers = []
|
||||
@ -80,7 +81,14 @@ def close_open_nodes(attach_logs_on_fail):
|
||||
except Exception as ex:
|
||||
if "No such container" in str(ex):
|
||||
crashed_containers.append(node.image)
|
||||
logger.error(f"Failed to stop container because of error {ex}")
|
||||
logger.error(f"Failed to stop node container because of error {ex}")
|
||||
for node in DS.client_nodes:
|
||||
try:
|
||||
node.stop()
|
||||
except Exception as ex:
|
||||
if "No such container" in str(ex):
|
||||
crashed_containers.append(node.name())
|
||||
logger.error(f"Failed to stop client node container because of error {ex}")
|
||||
assert not crashed_containers, f"Containers {crashed_containers} crashed during the test!!!"
|
||||
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ class TestHighLoadDos(StepsDataAvailability):
|
||||
assert failure_ratio_w < 0.20, f"Dispersal failure ratio {failure_ratio_w} too high"
|
||||
assert failure_ratio_r < 0.20, f"Data download failure ratio {failure_ratio_r} too high"
|
||||
|
||||
@pytest.mark.usefixtures("setup_2_node_cluster", "init_client_nodes")
|
||||
@pytest.mark.usefixtures("setup_2_node_cluster", "setup_client_nodes")
|
||||
def test_sustained_high_rate_multiple_clients(self):
|
||||
timeout = 60
|
||||
start_time = time.time()
|
||||
@ -121,8 +121,6 @@ class TestHighLoadDos(StepsDataAvailability):
|
||||
successful_downloads = 0
|
||||
unsuccessful_downloads = 0
|
||||
|
||||
self.client_nodes[0].run()
|
||||
|
||||
while True:
|
||||
if time.time() - start_time > timeout:
|
||||
break
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user