From 40994135773a3d9772236b3f7cdfa71d28b1ffed Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Fri, 23 Dec 2022 21:40:30 +0300 Subject: [PATCH] #478 Update lock tests Signed-off-by: Andrey Berezin --- pytest_tests/steps/cluster_test_base.py | 6 ++++++ pytest_tests/testsuites/object/test_object_lock.py | 13 ++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pytest_tests/steps/cluster_test_base.py b/pytest_tests/steps/cluster_test_base.py index c5f0b32b..e895c472 100644 --- a/pytest_tests/steps/cluster_test_base.py +++ b/pytest_tests/steps/cluster_test_base.py @@ -1,3 +1,4 @@ +import allure import epoch import pytest from cluster import Cluster @@ -15,6 +16,11 @@ class ClusterTestBase: ClusterTestBase.cluster = cluster yield + @allure.title("Tick {epochs_to_tick} epochs") + def tick_epochs(self, epochs_to_tick: int): + for _ in range(epochs_to_tick): + self.tick_epoch() + def tick_epoch(self): epoch.tick_epoch(self.shell, self.cluster) diff --git a/pytest_tests/testsuites/object/test_object_lock.py b/pytest_tests/testsuites/object/test_object_lock.py index a6d587ed..8e0548a6 100755 --- a/pytest_tests/testsuites/object/test_object_lock.py +++ b/pytest_tests/testsuites/object/test_object_lock.py @@ -297,7 +297,7 @@ class TestObjectLockWithGrpc(ClusterTestBase): storage_object.oid, self.shell, self.cluster.default_rpc_endpoint, - lifetime=3, + lifetime=2, ) lock_object( storage_object.wallet_file_path, @@ -305,12 +305,11 @@ class TestObjectLockWithGrpc(ClusterTestBase): storage_object.oid, self.shell, self.cluster.default_rpc_endpoint, - expire_at=current_epoch + 3, + expire_at=current_epoch + 2, ) with allure.step("Check object is not deleted at expiration time"): - self.tick_epoch() - self.tick_epoch() + self.tick_epochs(2) # Must wait to ensure object is not deleted wait_for_gc_pass_on_storage_nodes() with expect_not_raises(): @@ -452,7 +451,7 @@ class TestObjectLockWithGrpc(ClusterTestBase): ) current_epoch = self.ensure_fresh_epoch() - storage_object = user_container.generate_object(object_size, expire_at=current_epoch + 1) + storage_object = user_container.generate_object(object_size, expire_at=current_epoch + 5) lock_object( storage_object.wallet_file_path, @@ -463,7 +462,7 @@ class TestObjectLockWithGrpc(ClusterTestBase): lifetime=1, ) - self.tick_epoch() + self.tick_epochs(2) with expect_not_raises(): delete_object( storage_object.wallet_file_path, @@ -506,7 +505,7 @@ class TestObjectLockWithGrpc(ClusterTestBase): expire_at=current_epoch + 1, ) - self.tick_epoch() + self.tick_epochs(2) with expect_not_raises(): delete_object(