forked from TrueCloudLab/frostfs-testcases
Change sanity makrs first step
Signed-off-by: anikeev-yadro <a.anikeev@yadro.com>
This commit is contained in:
parent
52ea27e01e
commit
d0ec778346
3 changed files with 18 additions and 54 deletions
|
@ -79,9 +79,7 @@ def generate_ranges(
|
||||||
range_length = random.randint(RANGE_MIN_LEN, RANGE_MAX_LEN)
|
range_length = random.randint(RANGE_MIN_LEN, RANGE_MAX_LEN)
|
||||||
range_start = random.randint(offset, offset + length)
|
range_start = random.randint(offset, offset + length)
|
||||||
|
|
||||||
file_ranges_to_test.append(
|
file_ranges_to_test.append((range_start, min(range_length, storage_object.size - range_start)))
|
||||||
(range_start, min(range_length, storage_object.size - range_start))
|
|
||||||
)
|
|
||||||
|
|
||||||
file_ranges_to_test.extend(STATIC_RANGES.get(storage_object.size, []))
|
file_ranges_to_test.extend(STATIC_RANGES.get(storage_object.size, []))
|
||||||
|
|
||||||
|
@ -250,9 +248,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
assert sorted(expected_oids) == sorted(result)
|
assert sorted(expected_oids) == sorted(result)
|
||||||
|
|
||||||
@allure.title("Search objects with removed items (obj_size={object_size})")
|
@allure.title("Search objects with removed items (obj_size={object_size})")
|
||||||
def test_object_search_should_return_tombstone_items(
|
def test_object_search_should_return_tombstone_items(self, default_wallet: str, object_size: ObjectSize):
|
||||||
self, default_wallet: str, object_size: ObjectSize
|
|
||||||
):
|
|
||||||
"""
|
"""
|
||||||
Validate object search with removed items
|
Validate object search with removed items
|
||||||
"""
|
"""
|
||||||
|
@ -275,9 +271,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
|
|
||||||
with allure.step("Search object"):
|
with allure.step("Search object"):
|
||||||
# Root Search object should return root object oid
|
# Root Search object should return root object oid
|
||||||
result = search_object(
|
result = search_object(wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, root=True)
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, root=True
|
|
||||||
)
|
|
||||||
assert result == [storage_object.oid]
|
assert result == [storage_object.oid]
|
||||||
|
|
||||||
with allure.step("Delete file"):
|
with allure.step("Delete file"):
|
||||||
|
@ -285,22 +279,14 @@ class TestObjectApi(ClusterTestBase):
|
||||||
|
|
||||||
with allure.step("Search deleted object with --root"):
|
with allure.step("Search deleted object with --root"):
|
||||||
# Root Search object should return nothing
|
# Root Search object should return nothing
|
||||||
result = search_object(
|
result = search_object(wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, root=True)
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, root=True
|
|
||||||
)
|
|
||||||
assert len(result) == 0
|
assert len(result) == 0
|
||||||
|
|
||||||
with allure.step("Search deleted object with --phy should return only tombstones"):
|
with allure.step("Search deleted object with --phy should return only tombstones"):
|
||||||
# Physical Search object should return only tombstones
|
# Physical Search object should return only tombstones
|
||||||
result = search_object(
|
result = search_object(wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, phy=True)
|
||||||
wallet, cid, shell=self.shell, endpoint=self.cluster.default_rpc_endpoint, phy=True
|
assert storage_object.tombstone in result, "Search result should contain tombstone of removed object"
|
||||||
)
|
assert storage_object.oid not in result, "Search result should not contain ObjectId of removed object"
|
||||||
assert (
|
|
||||||
storage_object.tombstone in result
|
|
||||||
), "Search result should contain tombstone of removed object"
|
|
||||||
assert (
|
|
||||||
storage_object.oid not in result
|
|
||||||
), "Search result should not contain ObjectId of removed object"
|
|
||||||
for tombstone_oid in result:
|
for tombstone_oid in result:
|
||||||
header = head_object(
|
header = head_object(
|
||||||
wallet,
|
wallet,
|
||||||
|
@ -315,7 +301,6 @@ class TestObjectApi(ClusterTestBase):
|
||||||
), f"Object wasn't deleted properly. Found object {tombstone_oid} with type {object_type}"
|
), f"Object wasn't deleted properly. Found object {tombstone_oid} with type {object_type}"
|
||||||
|
|
||||||
@allure.title("Get range hash by native API (obj_size={object_size})")
|
@allure.title("Get range hash by native API (obj_size={object_size})")
|
||||||
@pytest.mark.sanity
|
|
||||||
@pytest.mark.grpc_api
|
@pytest.mark.grpc_api
|
||||||
def test_object_get_range_hash(self, storage_objects: list[StorageObjectInfo], max_object_size):
|
def test_object_get_range_hash(self, storage_objects: list[StorageObjectInfo], max_object_size):
|
||||||
"""
|
"""
|
||||||
|
@ -327,9 +312,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
oids = [storage_object.oid for storage_object in storage_objects[:2]]
|
oids = [storage_object.oid for storage_object in storage_objects[:2]]
|
||||||
file_path = storage_objects[0].file_path
|
file_path = storage_objects[0].file_path
|
||||||
|
|
||||||
file_ranges_to_test = generate_ranges(
|
file_ranges_to_test = generate_ranges(storage_objects[0], max_object_size, self.shell, self.cluster)
|
||||||
storage_objects[0], max_object_size, self.shell, self.cluster
|
|
||||||
)
|
|
||||||
logging.info(f"Ranges used in test {file_ranges_to_test}")
|
logging.info(f"Ranges used in test {file_ranges_to_test}")
|
||||||
|
|
||||||
for range_start, range_len in file_ranges_to_test:
|
for range_start, range_len in file_ranges_to_test:
|
||||||
|
@ -349,7 +332,6 @@ class TestObjectApi(ClusterTestBase):
|
||||||
), f"Expected range hash to match {range_cut} slice of file payload"
|
), f"Expected range hash to match {range_cut} slice of file payload"
|
||||||
|
|
||||||
@allure.title("Get range by native API (obj_size={object_size})")
|
@allure.title("Get range by native API (obj_size={object_size})")
|
||||||
@pytest.mark.sanity
|
|
||||||
@pytest.mark.grpc_api
|
@pytest.mark.grpc_api
|
||||||
def test_object_get_range(self, storage_objects: list[StorageObjectInfo], max_object_size):
|
def test_object_get_range(self, storage_objects: list[StorageObjectInfo], max_object_size):
|
||||||
"""
|
"""
|
||||||
|
@ -361,9 +343,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
oids = [storage_object.oid for storage_object in storage_objects[:2]]
|
oids = [storage_object.oid for storage_object in storage_objects[:2]]
|
||||||
file_path = storage_objects[0].file_path
|
file_path = storage_objects[0].file_path
|
||||||
|
|
||||||
file_ranges_to_test = generate_ranges(
|
file_ranges_to_test = generate_ranges(storage_objects[0], max_object_size, self.shell, self.cluster)
|
||||||
storage_objects[0], max_object_size, self.shell, self.cluster
|
|
||||||
)
|
|
||||||
logging.info(f"Ranges used in test {file_ranges_to_test}")
|
logging.info(f"Ranges used in test {file_ranges_to_test}")
|
||||||
|
|
||||||
for range_start, range_len in file_ranges_to_test:
|
for range_start, range_len in file_ranges_to_test:
|
||||||
|
@ -379,14 +359,11 @@ class TestObjectApi(ClusterTestBase):
|
||||||
range_cut=range_cut,
|
range_cut=range_cut,
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
get_file_content(
|
get_file_content(file_path, content_len=range_len, mode="rb", offset=range_start)
|
||||||
file_path, content_len=range_len, mode="rb", offset=range_start
|
|
||||||
)
|
|
||||||
== range_content
|
== range_content
|
||||||
), f"Expected range content to match {range_cut} slice of file payload"
|
), f"Expected range content to match {range_cut} slice of file payload"
|
||||||
|
|
||||||
@allure.title("[NEGATIVE] Get invalid range by native API (obj_size={object_size})")
|
@allure.title("[NEGATIVE] Get invalid range by native API (obj_size={object_size})")
|
||||||
@pytest.mark.sanity
|
|
||||||
@pytest.mark.grpc_api
|
@pytest.mark.grpc_api
|
||||||
def test_object_get_range_negatives(
|
def test_object_get_range_negatives(
|
||||||
self,
|
self,
|
||||||
|
@ -421,11 +398,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
|
|
||||||
for range_start, range_len, expected_error in file_ranges_to_test:
|
for range_start, range_len, expected_error in file_ranges_to_test:
|
||||||
range_cut = f"{range_start}:{range_len}"
|
range_cut = f"{range_start}:{range_len}"
|
||||||
expected_error = (
|
expected_error = expected_error.format(range=range_cut) if "{range}" in expected_error else expected_error
|
||||||
expected_error.format(range=range_cut)
|
|
||||||
if "{range}" in expected_error
|
|
||||||
else expected_error
|
|
||||||
)
|
|
||||||
with allure.step(f"Get range ({range_cut})"):
|
with allure.step(f"Get range ({range_cut})"):
|
||||||
for oid in oids:
|
for oid in oids:
|
||||||
with pytest.raises(Exception, match=expected_error):
|
with pytest.raises(Exception, match=expected_error):
|
||||||
|
@ -472,11 +445,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
|
|
||||||
for range_start, range_len, expected_error in file_ranges_to_test:
|
for range_start, range_len, expected_error in file_ranges_to_test:
|
||||||
range_cut = f"{range_start}:{range_len}"
|
range_cut = f"{range_start}:{range_len}"
|
||||||
expected_error = (
|
expected_error = expected_error.format(range=range_cut) if "{range}" in expected_error else expected_error
|
||||||
expected_error.format(range=range_cut)
|
|
||||||
if "{range}" in expected_error
|
|
||||||
else expected_error
|
|
||||||
)
|
|
||||||
with allure.step(f"Get range hash ({range_cut})"):
|
with allure.step(f"Get range hash ({range_cut})"):
|
||||||
for oid in oids:
|
for oid in oids:
|
||||||
with pytest.raises(Exception, match=expected_error):
|
with pytest.raises(Exception, match=expected_error):
|
||||||
|
@ -491,9 +460,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
|
|
||||||
def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
|
def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
|
||||||
for key_to_check, val_to_check in object_header.items():
|
for key_to_check, val_to_check in object_header.items():
|
||||||
assert (
|
assert key_to_check in head_info["header"]["attributes"], f"Key {key_to_check} is found in {head_object}"
|
||||||
key_to_check in head_info["header"]["attributes"]
|
|
||||||
), f"Key {key_to_check} is found in {head_object}"
|
|
||||||
assert head_info["header"]["attributes"].get(key_to_check) == str(
|
assert head_info["header"]["attributes"].get(key_to_check) == str(
|
||||||
val_to_check
|
val_to_check
|
||||||
), f"Value {val_to_check} is equal"
|
), f"Value {val_to_check} is equal"
|
||||||
|
|
|
@ -79,7 +79,6 @@ def storage_objects(
|
||||||
return storage_objects
|
return storage_objects
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sanity
|
|
||||||
@pytest.mark.smoke
|
@pytest.mark.smoke
|
||||||
@pytest.mark.bearer
|
@pytest.mark.bearer
|
||||||
class TestObjectApiWithBearerToken(ClusterTestBase):
|
class TestObjectApiWithBearerToken(ClusterTestBase):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from re import match, fullmatch
|
from re import fullmatch, match
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -14,8 +14,8 @@ from pytest import FixtureRequest
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
|
||||||
@allure.title("Check binaries versions")
|
@allure.title("Check binaries versions")
|
||||||
@pytest.mark.sanity
|
|
||||||
@pytest.mark.check_binaries
|
@pytest.mark.check_binaries
|
||||||
def test_binaries_versions(request: FixtureRequest, hosting: Hosting):
|
def test_binaries_versions(request: FixtureRequest, hosting: Hosting):
|
||||||
"""
|
"""
|
||||||
|
@ -31,8 +31,8 @@ def test_binaries_versions(request: FixtureRequest, hosting: Hosting):
|
||||||
# compare versions from servers and file
|
# compare versions from servers and file
|
||||||
exeptions = []
|
exeptions = []
|
||||||
additional_env_properties = {}
|
additional_env_properties = {}
|
||||||
|
|
||||||
for binary, version in got_versions.items():
|
for binary, version in got_versions.items():
|
||||||
if not fullmatch(r"^\d+\.\d+\.\d+(-.*)?(?<!dirty)", version):
|
if not fullmatch(r"^\d+\.\d+\.\d+(-.*)?(?<!dirty)", version):
|
||||||
exeptions.append(f"{binary}: Actual version doesn't conform to format '0.0.0-000-aaaaaaa': {version}")
|
exeptions.append(f"{binary}: Actual version doesn't conform to format '0.0.0-000-aaaaaaa': {version}")
|
||||||
|
|
||||||
|
@ -56,9 +56,7 @@ def download_versions_info(url: str) -> dict:
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
assert (
|
assert response.status_code == HTTPStatus.OK, f"Got {response.status_code} code. Content {response.json()}"
|
||||||
response.status_code == HTTPStatus.OK
|
|
||||||
), f"Got {response.status_code} code. Content {response.json()}"
|
|
||||||
|
|
||||||
content = response.text
|
content = response.text
|
||||||
assert content, f"Expected file with content, got {response}"
|
assert content, f"Expected file with content, got {response}"
|
||||||
|
|
Loading…
Reference in a new issue