#478 Update lock tests

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
support/v0.36 v0.35.0
Andrey Berezin 2022-12-23 21:40:30 +03:00 committed by abereziny
parent 1abf544433
commit 4099413577
2 changed files with 12 additions and 7 deletions

View File

@ -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)

View File

@ -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(