From 568b4421ce53a891d062bfe197f58e9aa1cf35ad Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Thu, 21 Jul 2022 16:11:59 +0400 Subject: [PATCH] Fix object lifetime tests We should wait for GC pass on storage nodes, because object with expiration is garbage collected only after epoch ticks. Signed-off-by: Vladimir Domnich --- pytest_tests/testsuites/object/test_object_api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pytest_tests/testsuites/object/test_object_api.py b/pytest_tests/testsuites/object/test_object_api.py index 0cbcdf0..5134406 100644 --- a/pytest_tests/testsuites/object/test_object_api.py +++ b/pytest_tests/testsuites/object/test_object_api.py @@ -3,7 +3,7 @@ from time import sleep import allure import pytest -from common import SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE +from common import SHARD_0_GC_SLEEP, SIMPLE_OBJ_SIZE, COMPLEX_OBJ_SIZE from container import create_container from epoch import get_epoch, tick_epoch from python_keywords.neofs_verbs import (delete_object, get_object, get_range, @@ -12,7 +12,7 @@ from python_keywords.neofs_verbs import (delete_object, get_object, get_range, from python_keywords.storage_policy import get_simple_object_copies from python_keywords.utility_keywords import generate_file, get_file_hash from tombstone import verify_head_tombstone -from utility import get_file_content +from utility import get_file_content, robot_time_to_int logger = logging.getLogger('NeoLogger') @@ -119,10 +119,14 @@ def test_object_api(prepare_wallet_and_deposit, request, object_size): assert get_file_hash(got_file) == file_hash with allure.step('Tick two epochs'): - for _ in range(3): + for _ in range(2): tick_epoch() - with allure.step('Check object deleted because if expires-on epoch'): + # Wait for GC, because object with expiration is counted as alive until GC removes it + with allure.step('Wait until GC completes on storage nodes'): + sleep(robot_time_to_int(SHARD_0_GC_SLEEP)) + + with allure.step('Check object deleted because it expires-on epoch'): with pytest.raises(Exception, match='.*object not found.*'): get_object(wallet, cid, oid)