mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-03 05:33:10 +00:00
fix: add optional timeout to disperse and get range
This commit is contained in:
parent
bf7644bcf4
commit
48847ce5cc
@ -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
|
||||
|
||||
@ -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}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user