[#160] Add try\except

Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
Dmitriy Zayakin 2023-11-28 09:30:21 +03:00 committed by Dmitriy Zayakin
parent 8f339ecbcd
commit e2e4a0c667

View file

@ -99,20 +99,25 @@ class TestFailoverServer(ClusterTestBase):
self, nodes: list[StorageNode], storage_objects: list[StorageObjectInfo] self, nodes: list[StorageNode], storage_objects: list[StorageObjectInfo]
) -> list[StorageObjectInfo]: ) -> list[StorageObjectInfo]:
corrupted_objects = [] corrupted_objects = []
errors_get = []
for node in nodes: for node in nodes:
for storage_object in storage_objects: for storage_object in storage_objects:
got_file_path = get_object( try:
storage_object.wallet_file_path, got_file_path = get_object(
storage_object.cid, storage_object.wallet_file_path,
storage_object.oid, storage_object.cid,
endpoint=node.get_rpc_endpoint(), storage_object.oid,
shell=self.shell, endpoint=node.get_rpc_endpoint(),
timeout="60s", shell=self.shell,
) timeout="60s",
if storage_object.file_hash != get_file_hash(got_file_path): )
corrupted_objects.append(storage_object) if storage_object.file_hash != get_file_hash(got_file_path):
os.remove(got_file_path) corrupted_objects.append(storage_object)
os.remove(got_file_path)
except RuntimeError:
errors_get.append(storage_object.oid)
assert len(errors_get) == 0, f"Get failed - {errors_get}"
return corrupted_objects return corrupted_objects
def check_objects_replication( def check_objects_replication(