Skip to content

Commit

Permalink
tests: update test_object_api_lifetime
Browse files Browse the repository at this point in the history
Add proper checks for lifetime, expire_at params

Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Sep 1, 2023
1 parent fe46bc7 commit cbab558
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions pytest_tests/testsuites/object/test_object_lifetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import allure
import pytest
from epoch import get_epoch, tick_epoch
from epoch import get_epoch
from file_helper import generate_file, get_file_hash
from grpc_responses import OBJECT_NOT_FOUND
from pytest import FixtureRequest
Expand All @@ -19,12 +19,15 @@
class TestObjectApiLifetime(ClusterTestBase):
@allure.title("Test object life time")
@pytest.mark.parametrize(
"object_size",
[pytest.lazy_fixture("simple_object_size"), pytest.lazy_fixture("complex_object_size")],
ids=["simple object", "complex object"],
"object_size,expiration_flag",
[
(pytest.lazy_fixture("simple_object_size"), "lifetime"),
(pytest.lazy_fixture("complex_object_size"), "expire_at"),
],
ids=["simple object, lifetime", "complex object, expire_at"],
)
def test_object_api_lifetime(
self, default_wallet: str, request: FixtureRequest, object_size: int
self, default_wallet: str, request: FixtureRequest, object_size: int, expiration_flag: str
):
"""
Test object deleted after expiration epoch.
Expand All @@ -41,7 +44,13 @@ def test_object_api_lifetime(
epoch = get_epoch(self.shell, self.cluster)

oid = put_object_to_random_node(
wallet, file_path, cid, self.shell, self.cluster, expire_at=epoch + 1
wallet,
file_path,
cid,
self.shell,
self.cluster,
expire_at=epoch + 1 if expiration_flag == "expire_at" else None,
lifetime=1 if expiration_flag == "lifetime" else None,
)
got_file = get_object_from_random_node(wallet, cid, oid, self.shell, self.cluster)
assert get_file_hash(got_file) == file_hash
Expand Down

0 comments on commit cbab558

Please sign in to comment.