Skip to content

Commit

Permalink
Lock object tests enhancements (#624)
Browse files Browse the repository at this point in the history
Relates to #550
  • Loading branch information
roman-khimov authored Sep 5, 2023
2 parents eedfba4 + f073622 commit bb98cab
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
34 changes: 28 additions & 6 deletions pytest_tests/testsuites/object/test_object_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_locked_object_cannot_be_deleted(
self.cluster.default_rpc_endpoint,
)

@allure.title("Lock object itself should be protected from deletion")
@allure.title("Lock object of a simple object should be protected from deletion")
# We operate with only lock object here so no complex object needed in this test
@pytest.mark.parametrize(
"locked_storage_object", [pytest.lazy_fixture("simple_object_size")], indirect=True
Expand All @@ -197,7 +197,7 @@ def test_lock_object_itself_cannot_be_deleted(
self.cluster.default_rpc_endpoint,
)

@allure.title("Lock object itself cannot be locked")
@allure.title("Lock object of a simple object cannot be locked")
# We operate with only lock object here so no complex object needed in this test
@pytest.mark.parametrize(
"locked_storage_object", [pytest.lazy_fixture("simple_object_size")], indirect=True
Expand All @@ -223,7 +223,7 @@ def test_lock_object_cannot_be_locked(
1,
)

@allure.title("Cannot lock object without lifetime and expire_at fields")
@allure.title("Cannot lock simple object without lifetime and expire_at fields")
# We operate with only lock object here so no complex object needed in this test
@pytest.mark.parametrize(
"locked_storage_object", [pytest.lazy_fixture("simple_object_size")], indirect=True
Expand Down Expand Up @@ -550,7 +550,7 @@ def test_complex_object_chunks_should_also_be_protected_from_deletion(
self.cluster.default_rpc_endpoint,
)

@allure.title("Link object of locked complex object can be dropped")
@allure.title("Link object of locked complex object can be dropped via control")
@pytest.mark.grpc_control
@pytest.mark.parametrize(
"new_locked_storage_object",
Expand Down Expand Up @@ -580,7 +580,7 @@ def test_link_object_of_locked_complex_object_can_be_dropped(
with expect_not_raises():
drop_object(node, new_locked_storage_object.cid, link_object_id)

@allure.title("Chunks of locked complex object can be dropped")
@allure.title("Chunks of locked complex object can be dropped via control")
@pytest.mark.grpc_control
@pytest.mark.parametrize(
"new_locked_storage_object",
Expand Down Expand Up @@ -617,7 +617,7 @@ def test_chunks_of_locked_complex_object_can_be_dropped(
def test_locked_object_can_be_dropped(
self, new_locked_storage_object: StorageObjectInfo, request: FixtureRequest
):
allure.dynamic.title(f"Locked {request.node.callspec.id} can be dropped")
allure.dynamic.title(f"Locked {request.node.callspec.id} can be dropped via control")
nodes_with_object = get_nodes_with_object(
new_locked_storage_object.cid,
new_locked_storage_object.oid,
Expand All @@ -629,6 +629,28 @@ def test_locked_object_can_be_dropped(
with expect_not_raises():
drop_object(node, new_locked_storage_object.cid, new_locked_storage_object.oid)

@allure.title("Lock object of a simple object can be dropped via control")
@pytest.mark.parametrize(
"locked_storage_object", [pytest.lazy_fixture("simple_object_size")], indirect=True
)
def test_lock_object_can_be_dropped(
self,
locked_storage_object: StorageObjectInfo,
):

lock_object_info = locked_storage_object.locks[0]

nodes_with_object = get_nodes_with_object(
lock_object_info.cid,
lock_object_info.oid,
shell=self.shell,
nodes=self.cluster.storage_nodes,
)

for node in nodes_with_object:
with expect_not_raises():
drop_object(node, lock_object_info.cid, lock_object_info.oid)

@allure.title("Link object of complex object should also be protected from deletion")
@pytest.mark.parametrize(
# Only complex objects are required for this test
Expand Down
2 changes: 1 addition & 1 deletion robot/resources/lib/python_keywords/node_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def drop_object(node: StorageNode, cid: str, oid: str) -> str:
Args:
node_id str: node from which object should be dropped.
"""
command = f"control drop-objects -o {cid}/{oid}"
command = f"control drop-objects -o {cid}/{oid}"
return _run_control_command_with_retries(node, command)


Expand Down

0 comments on commit bb98cab

Please sign in to comment.