diff --git a/src/steps/da.py b/src/steps/da.py index 72941e5..67af39d 100644 --- a/src/steps/da.py +++ b/src/steps/da.py @@ -70,13 +70,17 @@ class StepsDataAvailability(StepsCommon): return disperse() @allure.step - def get_data_range(self, node, app_id, start, end, timeout_duration=45): + def get_data_range(self, node, app_id, start, end, client_node=None, timeout_duration=45): @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True) def get_range(): response = [] query = prepare_get_range_request(app_id, start, end) try: - response = node.send_get_data_range_request(query) + if client_node is None: + response = node.send_get_data_range_request(query) + else: + client_node.set_rest_api(node.name(), node.api_port_internal()) + response = client_node.send_get_data_range_request(query) except Exception as ex: assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) diff --git a/tests/dos_robustness/test_high_load_dos.py b/tests/dos_robustness/test_high_load_dos.py index dc27648..adc2076 100644 --- a/tests/dos_robustness/test_high_load_dos.py +++ b/tests/dos_robustness/test_high_load_dos.py @@ -1,3 +1,4 @@ +import random import time import pytest @@ -125,24 +126,23 @@ class TestHighLoadDos(StepsDataAvailability): if time.time() - start_time > timeout: break + dispersal_cl, download_cl = random.choice(self.client_nodes), random.choice(self.client_nodes) + delay(0.01) try: - response = self.disperse_data(DATA_TO_DISPERSE[6], to_app_id(1), to_index(0), client_node=self.client_nodes[0], timeout_duration=0) - logger.debug(f"RESPONSE {response}") + response = self.disperse_data(DATA_TO_DISPERSE[6], to_app_id(1), to_index(0), client_node=dispersal_cl, timeout_duration=0) if response.status_code == 200: successful_dispersals += 1 else: unsuccessful_dispersals += 1 - except Exception as ex: - logger.debug(f"EXCEPTION {ex}") + except Exception: unsuccessful_dispersals += 1 - delay(3600) - # try: - # self.get_data_range(self.node2, to_app_id(1), to_index(0), to_index(5), timeout_duration=0) - # successful_downloads += 1 - # except Exception: - # unsuccessful_downloads += 1 + try: + self.get_data_range(self.node2, to_app_id(1), to_index(0), to_index(5), client_node=download_cl, timeout_duration=0) + successful_downloads += 1 + except Exception: + unsuccessful_downloads += 1 assert successful_dispersals > 0, "No successful dispersals" assert successful_downloads > 0, "No successful downloads"