diff --git a/src/steps/da.py b/src/steps/da.py index 779742b..82960e8 100644 --- a/src/steps/da.py +++ b/src/steps/da.py @@ -75,28 +75,30 @@ class StepsDataAvailability(StepsCommon): return executor @allure.step - @retry(stop=stop_after_delay(65), wait=wait_fixed(1), reraise=True) - def disperse_data(self, data, app_id, index): - response = [] - request = prepare_dispersal_request(data, app_id, index) - executor = self.find_executor_node() - try: - response = executor.send_dispersal_request(request) - except Exception as ex: - assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) + def disperse_data(self, data, app_id, index, timeout_duration=65): + @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(1), reraise=True) + def disperse(my_self=self): + response = [] + request = prepare_dispersal_request(data, app_id, index) + executor = my_self.find_executor_node() + try: + response = executor.send_dispersal_request(request) + except Exception as ex: + assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) - assert response.status_code == 200, "Send dispersal finished with unexpected response code" + assert response.status_code == 200, "Send dispersal finished with unexpected response code" @allure.step - @retry(stop=stop_after_delay(45), wait=wait_fixed(1), reraise=True) - def get_data_range(self, node, app_id, start, end): - response = [] - query = prepare_get_range_request(app_id, start, end) - try: - response = node.send_get_data_range_request(query) - except Exception as ex: - assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) + def get_data_range(self, node, app_id, start, end, timeout_duration=45): + @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(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) + except Exception as ex: + assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) - assert response_contains_data(response), "Get data range response is empty" + assert response_contains_data(response), "Get data range response is empty" - return response + return response diff --git a/tests/dos_robustness/dos_robustness.py b/tests/dos_robustness/dos_robustness.py index 38c2d8b..f368fbf 100644 --- a/tests/dos_robustness/dos_robustness.py +++ b/tests/dos_robustness/dos_robustness.py @@ -17,7 +17,7 @@ class TestDosRobustness(StepsDataAvailability): successful_dispersals = 0 for i in range(1000): try: - self.disperse_data(DATA_TO_DISPERSE[0], to_app_id(1), to_index(0)) + self.disperse_data(DATA_TO_DISPERSE[0], to_app_id(1), to_index(0), timeout_duration=0) successful_dispersals = i except Exception as ex: logger.debug(f"Dispersal #{i} was not successful with error {ex}")