fix: get data range from remote host

This commit is contained in:
Roman 2025-03-06 02:14:41 +00:00
parent 7c4e0a64ec
commit 04f2f1ad85
No known key found for this signature in database
GPG Key ID: BB3828275C58EFF1
2 changed files with 16 additions and 12 deletions

View File

@ -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)

View File

@ -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"