[#161] Improve logging
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
3b071f02f7
commit
873d6e3d14
40 changed files with 980 additions and 950 deletions
|
@ -3,6 +3,7 @@ import re
|
|||
|
||||
import allure
|
||||
import pytest
|
||||
from frostfs_testlib import reporter
|
||||
from frostfs_testlib.resources.common import STORAGE_GC_TIME
|
||||
from frostfs_testlib.resources.error_patterns import (
|
||||
LIFETIME_REQUIRED,
|
||||
|
@ -41,7 +42,7 @@ FIXTURE_OBJECT_LIFETIME = 10
|
|||
scope="module",
|
||||
)
|
||||
def user_wallet(wallet_factory: WalletFactory):
|
||||
with allure.step("Create user wallet with container"):
|
||||
with reporter.step("Create user wallet with container"):
|
||||
wallet_file = wallet_factory.create_wallet()
|
||||
return wallet_file
|
||||
|
||||
|
@ -66,7 +67,7 @@ def locked_storage_object(
|
|||
"""
|
||||
Intention of this fixture is to provide storage object which is NOT expected to be deleted during test act phase
|
||||
"""
|
||||
with allure.step("Creating locked object"):
|
||||
with reporter.step("Creating locked object"):
|
||||
current_epoch = ensure_fresh_epoch(client_shell, cluster)
|
||||
expiration_epoch = current_epoch + FIXTURE_LOCK_LIFETIME
|
||||
|
||||
|
@ -87,12 +88,12 @@ def locked_storage_object(
|
|||
|
||||
yield storage_object
|
||||
|
||||
with allure.step("Delete created locked object"):
|
||||
with reporter.step("Delete created locked object"):
|
||||
current_epoch = get_epoch(client_shell, cluster)
|
||||
epoch_diff = expiration_epoch - current_epoch + 1
|
||||
|
||||
if epoch_diff > 0:
|
||||
with allure.step(f"Tick {epoch_diff} epochs"):
|
||||
with reporter.step(f"Tick {epoch_diff} epochs"):
|
||||
for _ in range(epoch_diff):
|
||||
tick_epoch(client_shell, cluster)
|
||||
try:
|
||||
|
@ -142,7 +143,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
Intention of this fixture is to provide new storage object for tests which may delete or corrupt the object or it's complementary objects
|
||||
So we need a new one each time we ask for it
|
||||
"""
|
||||
with allure.step("Creating locked object"):
|
||||
with reporter.step("Creating locked object"):
|
||||
current_epoch = self.get_epoch()
|
||||
|
||||
storage_object = user_container.generate_object(
|
||||
|
@ -278,7 +279,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
current_epoch = self.ensure_fresh_epoch()
|
||||
storage_object = user_container.generate_object(object_size.value, expire_at=current_epoch + 1)
|
||||
|
||||
with allure.step("Lock object for couple epochs"):
|
||||
with reporter.step("Lock object for couple epochs"):
|
||||
lock_object(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -296,7 +297,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
expire_at=current_epoch + 2,
|
||||
)
|
||||
|
||||
with allure.step("Check object is not deleted at expiration time"):
|
||||
with reporter.step("Check object is not deleted at expiration time"):
|
||||
self.tick_epochs(2)
|
||||
# Must wait to ensure object is not deleted
|
||||
wait_for_gc_pass_on_storage_nodes()
|
||||
|
@ -309,7 +310,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Wait for object to be deleted after third epoch"):
|
||||
with reporter.step("Wait for object to be deleted after third epoch"):
|
||||
self.tick_epoch()
|
||||
check_object_not_found(
|
||||
storage_object.wallet_file_path,
|
||||
|
@ -332,7 +333,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
current_epoch = ensure_fresh_epoch(self.shell, self.cluster)
|
||||
storage_objects: list[StorageObjectInfo] = []
|
||||
|
||||
with allure.step("Generate three objects"):
|
||||
with reporter.step("Generate three objects"):
|
||||
for _ in range(3):
|
||||
storage_objects.append(user_container.generate_object(object_size.value, expire_at=current_epoch + 5))
|
||||
|
||||
|
@ -346,7 +347,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
)
|
||||
|
||||
for storage_object in storage_objects:
|
||||
with allure.step(f"Try to delete object {storage_object.oid}"):
|
||||
with reporter.step(f"Try to delete object {storage_object.oid}"):
|
||||
with pytest.raises(Exception, match=OBJECT_IS_LOCKED):
|
||||
delete_object(
|
||||
storage_object.wallet_file_path,
|
||||
|
@ -356,7 +357,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Tick two epochs"):
|
||||
with reporter.step("Tick two epochs"):
|
||||
self.tick_epoch()
|
||||
self.tick_epoch()
|
||||
|
||||
|
@ -477,7 +478,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
|
||||
chunk_object_ids = get_storage_object_chunks(locked_storage_object, self.shell, self.cluster)
|
||||
for chunk_object_id in chunk_object_ids:
|
||||
with allure.step(f"Try to delete chunk object {chunk_object_id}"):
|
||||
with reporter.step(f"Try to delete chunk object {chunk_object_id}"):
|
||||
with pytest.raises(Exception, match=OBJECT_IS_LOCKED):
|
||||
delete_object(
|
||||
locked_storage_object.wallet_file_path,
|
||||
|
@ -504,7 +505,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.storage_nodes,
|
||||
)
|
||||
|
||||
with allure.step(f"Drop link object with id {link_object_id} from nodes"):
|
||||
with reporter.step(f"Drop link object with id {link_object_id} from nodes"):
|
||||
nodes_with_object = get_nodes_with_object(
|
||||
new_locked_storage_object.cid,
|
||||
link_object_id,
|
||||
|
@ -527,7 +528,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
chunk_objects = get_storage_object_chunks(new_locked_storage_object, self.shell, self.cluster)
|
||||
|
||||
for chunk_object_id in chunk_objects:
|
||||
with allure.step(f"Drop chunk object with id {chunk_object_id} from nodes"):
|
||||
with reporter.step(f"Drop chunk object with id {chunk_object_id} from nodes"):
|
||||
nodes_with_object = get_nodes_with_object(
|
||||
new_locked_storage_object.cid,
|
||||
chunk_object_id,
|
||||
|
@ -575,7 +576,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.storage_nodes,
|
||||
is_direct=False,
|
||||
)
|
||||
with allure.step(f"Try to delete link object {link_object_id}"):
|
||||
with reporter.step(f"Try to delete link object {link_object_id}"):
|
||||
with pytest.raises(Exception, match=OBJECT_IS_LOCKED):
|
||||
delete_object(
|
||||
locked_storage_object.wallet_file_path,
|
||||
|
@ -594,7 +595,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
current_epoch = self.ensure_fresh_epoch()
|
||||
storage_object = user_container.generate_object(object_size.value, expire_at=current_epoch + 1)
|
||||
|
||||
with allure.step("Apply first lock to object for 3 epochs"):
|
||||
with reporter.step("Apply first lock to object for 3 epochs"):
|
||||
lock_object_id_0 = lock_object(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -606,7 +607,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
|
||||
self.tick_epochs(2)
|
||||
|
||||
with allure.step("Check first lock is still available"):
|
||||
with reporter.step("Check first lock is still available"):
|
||||
verify_object_available(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -615,7 +616,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Apply second lock to object for 3 more epochs"):
|
||||
with reporter.step("Apply second lock to object for 3 more epochs"):
|
||||
lock_object_id_1 = lock_object(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -627,7 +628,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
|
||||
self.tick_epochs(2)
|
||||
|
||||
with allure.step("Verify first lock is expired and removed"):
|
||||
with reporter.step("Verify first lock is expired and removed"):
|
||||
check_object_not_found(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -636,7 +637,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Verify second lock is still available"):
|
||||
with reporter.step("Verify second lock is still available"):
|
||||
verify_object_available(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -645,7 +646,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Apply third lock to object for 3 more epochs"):
|
||||
with reporter.step("Apply third lock to object for 3 more epochs"):
|
||||
lock_object(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -655,7 +656,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
expire_at=current_epoch + 7,
|
||||
)
|
||||
|
||||
with allure.step("Verify object is deleted after all locks are expired"):
|
||||
with reporter.step("Verify object is deleted after all locks are expired"):
|
||||
self.tick_epochs(4)
|
||||
check_object_not_found(
|
||||
storage_object.wallet_file_path,
|
||||
|
@ -676,7 +677,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
current_epoch = self.ensure_fresh_epoch()
|
||||
storage_objects: list[StorageObjectInfo] = []
|
||||
|
||||
with allure.step("Generate two objects"):
|
||||
with reporter.step("Generate two objects"):
|
||||
for epoch_i in range(2):
|
||||
storage_objects.append(
|
||||
user_container.generate_object(object_size.value, expire_at=current_epoch + epoch_i + 3)
|
||||
|
@ -684,7 +685,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
|
||||
self.tick_epoch()
|
||||
|
||||
with allure.step("Lock objects for 4 epochs"):
|
||||
with reporter.step("Lock objects for 4 epochs"):
|
||||
lock_object(
|
||||
storage_objects[0].wallet_file_path,
|
||||
storage_objects[0].cid,
|
||||
|
@ -694,10 +695,10 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
expire_at=current_epoch + 4,
|
||||
)
|
||||
|
||||
with allure.step("Verify objects are available during next three epochs"):
|
||||
with reporter.step("Verify objects are available during next three epochs"):
|
||||
for epoch_i in range(3):
|
||||
self.tick_epoch()
|
||||
with allure.step(f"Check objects at epoch {current_epoch + epoch_i + 2}"):
|
||||
with reporter.step(f"Check objects at epoch {current_epoch + epoch_i + 2}"):
|
||||
for storage_object in storage_objects:
|
||||
verify_object_available(
|
||||
storage_object.wallet_file_path,
|
||||
|
@ -707,7 +708,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
|||
self.cluster.default_rpc_endpoint,
|
||||
)
|
||||
|
||||
with allure.step("Verify objects are deleted after lock was expired"):
|
||||
with reporter.step("Verify objects are deleted after lock was expired"):
|
||||
self.tick_epoch()
|
||||
for storage_object in storage_objects:
|
||||
check_object_not_found(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue