forked from TrueCloudLab/frostfs-testcases
Add grpc lock tests
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
08274d4620
commit
30ea4ab54e
13 changed files with 805 additions and 101 deletions
|
@ -1,14 +1,12 @@
|
|||
import logging
|
||||
from time import sleep, time
|
||||
from time import sleep
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
from common import STORAGE_NODE_SERVICE_NAME_REGEX
|
||||
from epoch import tick_epoch
|
||||
from grpc_responses import OBJECT_ALREADY_REMOVED
|
||||
from neofs_testlib.hosting import Hosting
|
||||
from neofs_testlib.shell import Shell
|
||||
from python_keywords.neofs_verbs import delete_object, get_object, head_object
|
||||
from python_keywords.neofs_verbs import delete_object, get_object
|
||||
from storage_object_info import StorageObjectInfo
|
||||
from tombstone import verify_head_tombstone
|
||||
|
||||
|
@ -17,38 +15,7 @@ logger = logging.getLogger("NeoLogger")
|
|||
CLEANUP_TIMEOUT = 10
|
||||
|
||||
|
||||
@allure.step("Waiting until object will be available on all nodes")
|
||||
def wait_until_objects_available_on_all_nodes(
|
||||
hosting: Hosting,
|
||||
storage_objects: list[StorageObjectInfo],
|
||||
shell: Shell,
|
||||
max_wait_time: int = 60,
|
||||
) -> None:
|
||||
start = time()
|
||||
|
||||
def wait_for_objects():
|
||||
for service_config in hosting.find_service_configs(STORAGE_NODE_SERVICE_NAME_REGEX):
|
||||
endpoint = service_config.attributes["rpc_endpoint"]
|
||||
for storage_object in storage_objects:
|
||||
head_object(
|
||||
storage_object.wallet,
|
||||
storage_object.cid,
|
||||
storage_object.oid,
|
||||
shell,
|
||||
endpoint=endpoint,
|
||||
)
|
||||
|
||||
while start + max_wait_time >= time():
|
||||
try:
|
||||
wait_for_objects()
|
||||
return
|
||||
except Exception as ex:
|
||||
logger.debug(ex)
|
||||
sleep(1)
|
||||
|
||||
raise ex
|
||||
|
||||
|
||||
@allure.step("Delete Objects")
|
||||
def delete_objects(storage_objects: list[StorageObjectInfo], shell: Shell) -> None:
|
||||
"""
|
||||
Deletes given storage objects.
|
||||
|
@ -61,10 +28,10 @@ def delete_objects(storage_objects: list[StorageObjectInfo], shell: Shell) -> No
|
|||
with allure.step("Delete objects"):
|
||||
for storage_object in storage_objects:
|
||||
storage_object.tombstone = delete_object(
|
||||
storage_object.wallet, storage_object.cid, storage_object.oid, shell
|
||||
storage_object.wallet_file_path, storage_object.cid, storage_object.oid, shell
|
||||
)
|
||||
verify_head_tombstone(
|
||||
wallet_path=storage_object.wallet,
|
||||
wallet_path=storage_object.wallet_file_path,
|
||||
cid=storage_object.cid,
|
||||
oid_ts=storage_object.tombstone,
|
||||
oid=storage_object.oid,
|
||||
|
@ -78,7 +45,7 @@ def delete_objects(storage_objects: list[StorageObjectInfo], shell: Shell) -> No
|
|||
for storage_object in storage_objects:
|
||||
with pytest.raises(Exception, match=OBJECT_ALREADY_REMOVED):
|
||||
get_object(
|
||||
storage_object.wallet,
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
storage_object.oid,
|
||||
shell=shell,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue