Remove common erros to testlib #8
45 changed files with 117 additions and 383 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
venv_macos
|
||||||
|
|
||||||
|
|
||||||
# ignore test results
|
# ignore test results
|
||||||
**/log.html
|
**/log.html
|
||||||
|
|
|
@ -3,12 +3,11 @@ import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import data_formatters
|
|
||||||
import yaml
|
import yaml
|
||||||
from frostfs_testlib.blockchain import RPCClient
|
from frostfs_testlib.blockchain import RPCClient
|
||||||
from frostfs_testlib.hosting import Host, Hosting
|
from frostfs_testlib.hosting import Host, Hosting
|
||||||
from frostfs_testlib.hosting.config import ServiceConfig
|
from frostfs_testlib.hosting.config import ServiceConfig
|
||||||
from test_control import wait_for_success
|
from frostfs_testlib.utils import wallet_utils
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -86,7 +85,7 @@ class NodeBase:
|
||||||
def get_wallet_public_key(self):
|
def get_wallet_public_key(self):
|
||||||
storage_wallet_path = self.get_wallet_path()
|
storage_wallet_path = self.get_wallet_path()
|
||||||
storage_wallet_pass = self.get_wallet_password()
|
storage_wallet_pass = self.get_wallet_password()
|
||||||
return data_formatters.get_wallet_public_key(storage_wallet_path, storage_wallet_pass)
|
return wallet_utils.get_wallet_public_key(storage_wallet_path, storage_wallet_pass)
|
||||||
|
|
||||||
def _get_attribute(self, attribute_name: str, default_attribute_name: str = None) -> list[str]:
|
def _get_attribute(self, attribute_name: str, default_attribute_name: str = None) -> list[str]:
|
||||||
config = self.host.get_service_config(self.name)
|
config = self.host.get_service_config(self.name)
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
import re
|
|
||||||
|
|
||||||
# Regex patterns of status codes of Container service (https://github.com/nspcc-dev/neofs-spec/blob/98b154848116223e486ce8b43eaa35fec08b4a99/20-api-v2/container.md)
|
|
||||||
CONTAINER_NOT_FOUND = "code = 3072.*message = container not found"
|
|
||||||
|
|
||||||
|
|
||||||
# Regex patterns of status codes of Object service (https://github.com/nspcc-dev/neofs-spec/blob/98b154848116223e486ce8b43eaa35fec08b4a99/20-api-v2/object.md)
|
|
||||||
MALFORMED_REQUEST = "code = 1024.*message = malformed request"
|
|
||||||
OBJECT_ACCESS_DENIED = "code = 2048.*message = access to object operation denied"
|
|
||||||
OBJECT_NOT_FOUND = "code = 2049.*message = object not found"
|
|
||||||
OBJECT_ALREADY_REMOVED = "code = 2052.*message = object already removed"
|
|
||||||
SESSION_NOT_FOUND = "code = 4096.*message = session token not found"
|
|
||||||
OUT_OF_RANGE = "code = 2053.*message = out of range"
|
|
||||||
EXPIRED_SESSION_TOKEN = "code = 4097.*message = expired session token"
|
|
||||||
# TODO: Due to https://github.com/nspcc-dev/neofs-node/issues/2092 we have to check only codes until fixed
|
|
||||||
# OBJECT_IS_LOCKED = "code = 2050.*message = object is locked"
|
|
||||||
# LOCK_NON_REGULAR_OBJECT = "code = 2051.*message = ..." will be available once 2092 is fixed
|
|
||||||
OBJECT_IS_LOCKED = "code = 2050"
|
|
||||||
LOCK_NON_REGULAR_OBJECT = "code = 2051"
|
|
||||||
|
|
||||||
LIFETIME_REQUIRED = "either expiration epoch of a lifetime is required"
|
|
||||||
LOCK_OBJECT_REMOVAL = "lock object removal"
|
|
||||||
LOCK_OBJECT_EXPIRATION = "lock object expiration: {expiration_epoch}; current: {current_epoch}"
|
|
||||||
INVALID_RANGE_ZERO_LENGTH = "invalid '{range}' range: zero length"
|
|
||||||
INVALID_RANGE_OVERFLOW = "invalid '{range}' range: uint64 overflow"
|
|
||||||
INVALID_OFFSET_SPECIFIER = "invalid '{range}' range offset specifier"
|
|
||||||
INVALID_LENGTH_SPECIFIER = "invalid '{range}' range length specifier"
|
|
||||||
|
|
||||||
|
|
||||||
def error_matches_status(error: Exception, status_pattern: str) -> bool:
|
|
||||||
"""
|
|
||||||
Determines whether exception matches specified status pattern.
|
|
||||||
|
|
||||||
We use re.search to be consistent with pytest.raises.
|
|
||||||
"""
|
|
||||||
match = re.search(status_pattern, str(error))
|
|
||||||
return match is not None
|
|
|
@ -2,32 +2,7 @@ import time
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
from common import STORAGE_GC_TIME
|
from common import STORAGE_GC_TIME
|
||||||
|
from frostfs_testlib.utils import datetime_utils
|
||||||
|
|
||||||
def parse_time(value: str) -> int:
|
|
||||||
"""Converts time interval in text form into time interval as number of seconds.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
value: time interval as text.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Number of seconds in the parsed time interval.
|
|
||||||
"""
|
|
||||||
value = value.lower()
|
|
||||||
|
|
||||||
for suffix in ["s", "sec"]:
|
|
||||||
if value.endswith(suffix):
|
|
||||||
return int(value[: -len(suffix)])
|
|
||||||
|
|
||||||
for suffix in ["m", "min"]:
|
|
||||||
if value.endswith(suffix):
|
|
||||||
return int(value[: -len(suffix)]) * 60
|
|
||||||
|
|
||||||
for suffix in ["h", "hr", "hour"]:
|
|
||||||
if value.endswith(suffix):
|
|
||||||
return int(value[: -len(suffix)]) * 60 * 60
|
|
||||||
|
|
||||||
raise ValueError(f"Unknown units in time value '{value}'")
|
|
||||||
|
|
||||||
|
|
||||||
def placement_policy_from_container(container_info: str) -> str:
|
def placement_policy_from_container(container_info: str) -> str:
|
||||||
|
@ -57,6 +32,6 @@ def placement_policy_from_container(container_info: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def wait_for_gc_pass_on_storage_nodes() -> None:
|
def wait_for_gc_pass_on_storage_nodes() -> None:
|
||||||
wait_time = parse_time(STORAGE_GC_TIME)
|
wait_time = datetime_utils.parse_time(STORAGE_GC_TIME)
|
||||||
with allure.step(f"Wait {wait_time}s until GC completes on storage nodes"):
|
with allure.step(f"Wait {wait_time}s until GC completes on storage nodes"):
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
||||||
from cluster import Cluster, NodeBase
|
from cluster import Cluster, NodeBase
|
||||||
from common import FREE_STORAGE, WALLET_CONFIG, WALLET_PASS
|
from common import FREE_STORAGE, WALLET_CONFIG, WALLET_PASS
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_testlib.utils.wallet import get_last_address_from_wallet, init_wallet
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from python_keywords.payment_neogo import deposit_gas, transfer_gas
|
from python_keywords.payment_neogo import deposit_gas, transfer_gas
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class WalletFile:
|
||||||
Returns:
|
Returns:
|
||||||
The address of the wallet.
|
The address of the wallet.
|
||||||
"""
|
"""
|
||||||
return get_last_address_from_wallet(self.path, self.password)
|
return wallet_utils.get_last_address_from_wallet(self.path, self.password)
|
||||||
|
|
||||||
|
|
||||||
class WalletFactory:
|
class WalletFactory:
|
||||||
|
@ -47,7 +47,7 @@ class WalletFactory:
|
||||||
WalletFile object of new wallet
|
WalletFile object of new wallet
|
||||||
"""
|
"""
|
||||||
wallet_path = os.path.join(self.wallets_dir, f"{str(uuid.uuid4())}.json")
|
wallet_path = os.path.join(self.wallets_dir, f"{str(uuid.uuid4())}.json")
|
||||||
init_wallet(wallet_path, password)
|
wallet_utils.init_wallet(wallet_path, password)
|
||||||
|
|
||||||
if not FREE_STORAGE:
|
if not FREE_STORAGE:
|
||||||
main_chain = self.cluster.main_chain_nodes[0]
|
main_chain = self.cluster.main_chain_nodes[0]
|
||||||
|
|
|
@ -8,12 +8,10 @@ from enum import Enum
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import json_transformers
|
|
||||||
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||||
from data_formatters import get_wallet_public_key
|
|
||||||
from frostfs_testlib.cli import FrostfsCli
|
from frostfs_testlib.cli import FrostfsCli
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from json_transformers import encode_for_json
|
from frostfs_testlib.utils import json_utils, wallet_utils
|
||||||
from storage_object_info import StorageObjectInfo
|
from storage_object_info import StorageObjectInfo
|
||||||
from wallet import WalletFile
|
from wallet import WalletFile
|
||||||
|
|
||||||
|
@ -71,16 +69,16 @@ def generate_session_token(
|
||||||
|
|
||||||
file_path = os.path.join(tokens_dir, str(uuid.uuid4()))
|
file_path = os.path.join(tokens_dir, str(uuid.uuid4()))
|
||||||
|
|
||||||
pub_key_64 = get_wallet_public_key(session_wallet.path, session_wallet.password, "base64")
|
pub_key_64 = wallet_utils.get_wallet_public_key(
|
||||||
|
session_wallet.path, session_wallet.password, "base64"
|
||||||
|
)
|
||||||
|
|
||||||
lifetime = lifetime or Lifetime()
|
lifetime = lifetime or Lifetime()
|
||||||
|
|
||||||
session_token = {
|
session_token = {
|
||||||
"body": {
|
"body": {
|
||||||
"id": f"{base64.b64encode(uuid.uuid4().bytes).decode('utf-8')}",
|
"id": f"{base64.b64encode(uuid.uuid4().bytes).decode('utf-8')}",
|
||||||
"ownerID": {
|
"ownerID": {"value": f"{json_utils.encode_for_json(owner_wallet.get_address())}"},
|
||||||
"value": f"{json_transformers.encode_for_json(owner_wallet.get_address())}"
|
|
||||||
},
|
|
||||||
"lifetime": {
|
"lifetime": {
|
||||||
"exp": f"{lifetime.exp}",
|
"exp": f"{lifetime.exp}",
|
||||||
"nbf": f"{lifetime.nbf}",
|
"nbf": f"{lifetime.nbf}",
|
||||||
|
@ -125,7 +123,11 @@ def generate_container_session_token(
|
||||||
"container": {
|
"container": {
|
||||||
"verb": verb.value,
|
"verb": verb.value,
|
||||||
"wildcard": cid is None,
|
"wildcard": cid is None,
|
||||||
**({"containerID": {"value": f"{encode_for_json(cid)}"}} if cid is not None else {}),
|
**(
|
||||||
|
{"containerID": {"value": f"{json_utils.encode_for_json(cid)}"}}
|
||||||
|
if cid is not None
|
||||||
|
else {}
|
||||||
|
),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,8 +167,8 @@ def generate_object_session_token(
|
||||||
"object": {
|
"object": {
|
||||||
"verb": verb.value,
|
"verb": verb.value,
|
||||||
"target": {
|
"target": {
|
||||||
"container": {"value": encode_for_json(cid)},
|
"container": {"value": json_utils.encode_for_json(cid)},
|
||||||
"objects": [{"value": encode_for_json(oid)} for oid in oids],
|
"objects": [{"value": json_utils.encode_for_json(oid)} for oid in oids],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
|
from frostfs_testlib.resources.common import OBJECT_ALREADY_REMOVED
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from grpc_responses import OBJECT_ALREADY_REMOVED
|
|
||||||
from python_keywords.frostfs_verbs import delete_object, get_object
|
from python_keywords.frostfs_verbs import delete_object, get_object
|
||||||
from storage_object_info import StorageObjectInfo
|
from storage_object_info import StorageObjectInfo
|
||||||
from tombstone import verify_head_tombstone
|
from tombstone import verify_head_tombstone
|
||||||
|
|
|
@ -8,12 +8,12 @@ import pytest
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from common import WALLET_CONFIG, WALLET_PASS
|
from common import WALLET_CONFIG, WALLET_PASS
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_testlib.utils.wallet import init_wallet
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from python_keywords.acl import EACLRole
|
from python_keywords.acl import EACLRole
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import put_object_to_random_node
|
from python_keywords.frostfs_verbs import put_object_to_random_node
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
OBJECT_COUNT = 5
|
OBJECT_COUNT = 5
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def wallets(default_wallet, temp_directory, cluster: Cluster) -> Wallets:
|
||||||
os.path.join(temp_directory, f"{str(uuid.uuid4())}.json") for _ in range(2)
|
os.path.join(temp_directory, f"{str(uuid.uuid4())}.json") for _ in range(2)
|
||||||
]
|
]
|
||||||
for other_wallet_path in other_wallets_paths:
|
for other_wallet_path in other_wallets_paths:
|
||||||
init_wallet(other_wallet_path, WALLET_PASS)
|
wallet_utils.init_wallet(other_wallet_path, WALLET_PASS)
|
||||||
|
|
||||||
ir_node = cluster.ir_nodes[0]
|
ir_node = cluster.ir_nodes[0]
|
||||||
storage_node = cluster.storage_nodes[0]
|
storage_node = cluster.storage_nodes[0]
|
||||||
|
|
|
@ -8,8 +8,8 @@ import pytest
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
|
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from frostfs_testlib.utils.wallet import init_wallet
|
from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND
|
||||||
from grpc_responses import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from python_keywords.acl import (
|
from python_keywords.acl import (
|
||||||
EACLAccess,
|
EACLAccess,
|
||||||
EACLOperation,
|
EACLOperation,
|
||||||
|
@ -48,7 +48,7 @@ class TestStorageGroup(ClusterTestBase):
|
||||||
def prepare_two_wallets(self, default_wallet):
|
def prepare_two_wallets(self, default_wallet):
|
||||||
self.main_wallet = default_wallet
|
self.main_wallet = default_wallet
|
||||||
self.other_wallet = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
self.other_wallet = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
||||||
init_wallet(self.other_wallet, WALLET_PASS)
|
wallet_utils.init_wallet(self.other_wallet, WALLET_PASS)
|
||||||
if not FREE_STORAGE:
|
if not FREE_STORAGE:
|
||||||
main_chain = self.cluster.main_chain_nodes[0]
|
main_chain = self.cluster.main_chain_nodes[0]
|
||||||
deposit = 30
|
deposit = 30
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
|
from frostfs_testlib.resources.common import PRIVATE_ACL_F, PUBLIC_ACL_F, READONLY_ACL_F
|
||||||
from python_keywords.acl import EACLRole
|
from python_keywords.acl import EACLRole
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.container_access import (
|
from python_keywords.container_access import (
|
||||||
|
@ -9,7 +10,6 @@ from python_keywords.container_access import (
|
||||||
check_read_only_container,
|
check_read_only_container,
|
||||||
)
|
)
|
||||||
from python_keywords.frostfs_verbs import put_object_to_random_node
|
from python_keywords.frostfs_verbs import put_object_to_random_node
|
||||||
from wellknown_acl import PRIVATE_ACL_F, PUBLIC_ACL_F, READONLY_ACL_F
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
|
|
|
@ -2,7 +2,7 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
from failover_utils import wait_object_replication
|
from failover_utils import wait_object_replication
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from python_keywords.acl import (
|
from python_keywords.acl import (
|
||||||
EACLAccess,
|
EACLAccess,
|
||||||
EACLOperation,
|
EACLOperation,
|
||||||
|
@ -28,7 +28,6 @@ from python_keywords.object_access import (
|
||||||
can_put_object,
|
can_put_object,
|
||||||
can_search_object,
|
can_search_object,
|
||||||
)
|
)
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from python_keywords.acl import (
|
from python_keywords.acl import (
|
||||||
EACLAccess,
|
EACLAccess,
|
||||||
EACLFilter,
|
EACLFilter,
|
||||||
|
@ -22,7 +23,6 @@ from python_keywords.container_access import (
|
||||||
)
|
)
|
||||||
from python_keywords.frostfs_verbs import put_object_to_random_node
|
from python_keywords.frostfs_verbs import put_object_to_random_node
|
||||||
from python_keywords.object_access import can_get_head_object, can_get_object, can_put_object
|
from python_keywords.object_access import can_get_head_object, can_get_object, can_put_object
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
import schemathesis
|
|
||||||
|
|
||||||
schema = schemathesis.from_uri("http://172.26.160.223:5000/api/openapi.json")
|
|
|
@ -24,7 +24,7 @@ from env_properties import save_env_properties
|
||||||
from frostfs_testlib.hosting import Hosting
|
from frostfs_testlib.hosting import Hosting
|
||||||
from frostfs_testlib.reporter import AllureHandler, get_reporter
|
from frostfs_testlib.reporter import AllureHandler, get_reporter
|
||||||
from frostfs_testlib.shell import LocalShell, Shell
|
from frostfs_testlib.shell import LocalShell, Shell
|
||||||
from frostfs_testlib.utils.wallet import init_wallet
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from k6 import LoadParams
|
from k6 import LoadParams
|
||||||
from load import get_services_endpoints, prepare_k6_instances
|
from load import get_services_endpoints, prepare_k6_instances
|
||||||
from load_params import (
|
from load_params import (
|
||||||
|
@ -242,7 +242,7 @@ def background_grpc_load(client_shell: Shell, hosting: Hosting):
|
||||||
@allure.title("Prepare wallet and deposit")
|
@allure.title("Prepare wallet and deposit")
|
||||||
def default_wallet(client_shell: Shell, temp_directory: str, cluster: Cluster):
|
def default_wallet(client_shell: Shell, temp_directory: str, cluster: Cluster):
|
||||||
wallet_path = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
wallet_path = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
||||||
init_wallet(wallet_path, WALLET_PASS)
|
wallet_utils.init_wallet(wallet_path, WALLET_PASS)
|
||||||
allure.attach.file(wallet_path, os.path.basename(wallet_path), allure.attachment_type.JSON)
|
allure.attach.file(wallet_path, os.path.basename(wallet_path), allure.attachment_type.JSON)
|
||||||
|
|
||||||
if not FREE_STORAGE:
|
if not FREE_STORAGE:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import json
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from epoch import tick_epoch
|
from frostfs_testlib.resources.common import PRIVATE_ACL_F
|
||||||
from python_keywords.container import (
|
from python_keywords.container import (
|
||||||
create_container,
|
create_container,
|
||||||
delete_container,
|
delete_container,
|
||||||
|
@ -12,7 +12,6 @@ from python_keywords.container import (
|
||||||
wait_for_container_deletion,
|
wait_for_container_deletion,
|
||||||
)
|
)
|
||||||
from utility import placement_policy_from_container
|
from utility import placement_policy_from_container
|
||||||
from wellknown_acl import PRIVATE_ACL_F
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ import pytest
|
||||||
from cluster import StorageNode
|
from cluster import StorageNode
|
||||||
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
|
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from iptables_helper import IpTablesHelper
|
from iptables_helper import IpTablesHelper
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import get_object, put_object_to_random_node
|
from python_keywords.frostfs_verbs import get_object, put_object_to_random_node
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ from cluster import Cluster, StorageNode
|
||||||
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
|
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
from frostfs_testlib.hosting import Host
|
from frostfs_testlib.hosting import Host
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from frostfs_testlib.shell import CommandOptions
|
from frostfs_testlib.shell import CommandOptions
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import get_object, put_object_to_random_node
|
from python_keywords.frostfs_verbs import get_object, put_object_to_random_node
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ from cluster_test_base import ClusterTestBase
|
||||||
from common import FROSTFS_CONTRACT_CACHE_TIMEOUT, MORPH_BLOCK_TIME
|
from common import FROSTFS_CONTRACT_CACHE_TIMEOUT, MORPH_BLOCK_TIME
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from grpc_responses import OBJECT_NOT_FOUND, error_matches_status
|
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL
|
||||||
|
from frostfs_testlib.utils import datetime_utils, string_utils
|
||||||
from python_keywords.container import create_container, get_container
|
from python_keywords.container import create_container, get_container
|
||||||
from python_keywords.failover_utils import wait_object_replication
|
from python_keywords.failover_utils import wait_object_replication
|
||||||
from python_keywords.frostfs_verbs import (
|
from python_keywords.frostfs_verbs import (
|
||||||
|
@ -27,17 +28,14 @@ from python_keywords.node_management import (
|
||||||
drop_object,
|
drop_object,
|
||||||
exclude_node_from_network_map,
|
exclude_node_from_network_map,
|
||||||
get_locode_from_random_node,
|
get_locode_from_random_node,
|
||||||
get_netmap_snapshot,
|
|
||||||
include_node_to_network_map,
|
include_node_to_network_map,
|
||||||
node_shard_list,
|
node_shard_list,
|
||||||
node_shard_set_mode,
|
node_shard_set_mode,
|
||||||
start_storage_nodes,
|
|
||||||
storage_node_healthcheck,
|
storage_node_healthcheck,
|
||||||
storage_node_set_status,
|
storage_node_set_status,
|
||||||
)
|
)
|
||||||
from storage_policy import get_nodes_with_object, get_simple_object_copies
|
from storage_policy import get_nodes_with_object, get_simple_object_copies
|
||||||
from utility import parse_time, placement_policy_from_container, wait_for_gc_pass_on_storage_nodes
|
from utility import placement_policy_from_container, wait_for_gc_pass_on_storage_nodes
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
check_nodes: list[StorageNode] = []
|
check_nodes: list[StorageNode] = []
|
||||||
|
@ -111,13 +109,13 @@ class TestNodeManagement(ClusterTestBase):
|
||||||
|
|
||||||
# We need to wait for node to establish notifications from morph-chain
|
# We need to wait for node to establish notifications from morph-chain
|
||||||
# Otherwise it will hang up when we will try to set status
|
# Otherwise it will hang up when we will try to set status
|
||||||
sleep(parse_time(MORPH_BLOCK_TIME))
|
sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
|
||||||
|
|
||||||
with allure.step(f"Move node {node} to online state"):
|
with allure.step(f"Move node {node} to online state"):
|
||||||
storage_node_set_status(node, status="online", retries=2)
|
storage_node_set_status(node, status="online", retries=2)
|
||||||
|
|
||||||
check_nodes.remove(node)
|
check_nodes.remove(node)
|
||||||
sleep(parse_time(MORPH_BLOCK_TIME))
|
sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
|
||||||
self.tick_epoch_with_retries(3)
|
self.tick_epoch_with_retries(3)
|
||||||
check_node_in_map(node, shell=self.shell, alive_node=alive_node)
|
check_node_in_map(node, shell=self.shell, alive_node=alive_node)
|
||||||
|
|
||||||
|
@ -474,7 +472,7 @@ class TestNodeManagement(ClusterTestBase):
|
||||||
if copies == expected_copies:
|
if copies == expected_copies:
|
||||||
break
|
break
|
||||||
tick_epoch(self.shell, self.cluster)
|
tick_epoch(self.shell, self.cluster)
|
||||||
sleep(parse_time(FROSTFS_CONTRACT_CACHE_TIMEOUT))
|
sleep(datetime_utils.parse_time(FROSTFS_CONTRACT_CACHE_TIMEOUT))
|
||||||
else:
|
else:
|
||||||
raise AssertionError(f"There are no {expected_copies} copies during time")
|
raise AssertionError(f"There are no {expected_copies} copies during time")
|
||||||
|
|
||||||
|
@ -485,7 +483,7 @@ class TestNodeManagement(ClusterTestBase):
|
||||||
checker(wallet, cid, oid, shell=self.shell, endpoint=endpoint)
|
checker(wallet, cid, oid, shell=self.shell, endpoint=endpoint)
|
||||||
wait_for_gc_pass_on_storage_nodes()
|
wait_for_gc_pass_on_storage_nodes()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if error_matches_status(err, OBJECT_NOT_FOUND):
|
if string_utils.is_str_match_pattern(err, OBJECT_NOT_FOUND):
|
||||||
return
|
return
|
||||||
raise AssertionError(f'Expected "{OBJECT_NOT_FOUND}" error, got\n{err}')
|
raise AssertionError(f'Expected "{OBJECT_NOT_FOUND}" error, got\n{err}')
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@ import pytest
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from complex_object_actions import get_complex_object_split_ranges
|
from complex_object_actions import get_complex_object_split_ranges
|
||||||
from file_helper import generate_file, get_file_content, get_file_hash
|
from file_helper import generate_file, get_file_content, get_file_hash
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.resources.common import (
|
||||||
from grpc_responses import (
|
|
||||||
INVALID_LENGTH_SPECIFIER,
|
INVALID_LENGTH_SPECIFIER,
|
||||||
INVALID_OFFSET_SPECIFIER,
|
INVALID_OFFSET_SPECIFIER,
|
||||||
INVALID_RANGE_OVERFLOW,
|
INVALID_RANGE_OVERFLOW,
|
||||||
INVALID_RANGE_ZERO_LENGTH,
|
INVALID_RANGE_ZERO_LENGTH,
|
||||||
OUT_OF_RANGE,
|
OUT_OF_RANGE,
|
||||||
)
|
)
|
||||||
|
from frostfs_testlib.shell import Shell
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import (
|
from python_keywords.frostfs_verbs import (
|
||||||
|
|
|
@ -3,11 +3,11 @@ import pytest
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from container import REP_2_FOR_3_NODES_PLACEMENT_RULE, SINGLE_PLACEMENT_RULE, create_container
|
from container import REP_2_FOR_3_NODES_PLACEMENT_RULE, SINGLE_PLACEMENT_RULE, create_container
|
||||||
from epoch import get_epoch
|
from epoch import get_epoch
|
||||||
|
from frostfs_testlib.resources.common import EACL_PUBLIC_READ_WRITE
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_verbs import delete_object, get_object
|
from frostfs_verbs import delete_object, get_object
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.acl import EACLAccess, EACLOperation, EACLRole, EACLRule, form_bearertoken_file
|
from python_keywords.acl import EACLAccess, EACLOperation, EACLRole, EACLRule, form_bearertoken_file
|
||||||
from wellknown_acl import EACL_PUBLIC_READ_WRITE
|
|
||||||
|
|
||||||
from helpers.container import StorageContainer, StorageContainerInfo
|
from helpers.container import StorageContainer, StorageContainerInfo
|
||||||
from helpers.test_control import expect_not_raises
|
from helpers.test_control import expect_not_raises
|
||||||
|
|
|
@ -2,9 +2,9 @@ import logging
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from epoch import get_epoch, tick_epoch
|
from epoch import get_epoch
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
from grpc_responses import OBJECT_NOT_FOUND
|
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import get_object_from_random_node, put_object_to_random_node
|
from python_keywords.frostfs_verbs import get_object_from_random_node, put_object_to_random_node
|
||||||
|
|
|
@ -8,8 +8,7 @@ from cluster_test_base import ClusterTestBase
|
||||||
from common import STORAGE_GC_TIME
|
from common import STORAGE_GC_TIME
|
||||||
from complex_object_actions import get_link_object, get_storage_object_chunks
|
from complex_object_actions import get_link_object, get_storage_object_chunks
|
||||||
from epoch import ensure_fresh_epoch, get_epoch, tick_epoch
|
from epoch import ensure_fresh_epoch, get_epoch, tick_epoch
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.resources.common import (
|
||||||
from grpc_responses import (
|
|
||||||
LIFETIME_REQUIRED,
|
LIFETIME_REQUIRED,
|
||||||
LOCK_NON_REGULAR_OBJECT,
|
LOCK_NON_REGULAR_OBJECT,
|
||||||
LOCK_OBJECT_EXPIRATION,
|
LOCK_OBJECT_EXPIRATION,
|
||||||
|
@ -18,13 +17,15 @@ from grpc_responses import (
|
||||||
OBJECT_IS_LOCKED,
|
OBJECT_IS_LOCKED,
|
||||||
OBJECT_NOT_FOUND,
|
OBJECT_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
from frostfs_testlib.shell import Shell
|
||||||
|
from frostfs_testlib.utils import datetime_utils
|
||||||
from node_management import drop_object
|
from node_management import drop_object
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import delete_object, head_object, lock_object
|
from python_keywords.frostfs_verbs import delete_object, head_object, lock_object
|
||||||
from storage_policy import get_nodes_with_object
|
from storage_policy import get_nodes_with_object
|
||||||
from test_control import expect_not_raises, wait_for_success
|
from test_control import expect_not_raises, wait_for_success
|
||||||
from utility import parse_time, wait_for_gc_pass_on_storage_nodes
|
from utility import wait_for_gc_pass_on_storage_nodes
|
||||||
|
|
||||||
from helpers.container import StorageContainer, StorageContainerInfo
|
from helpers.container import StorageContainer, StorageContainerInfo
|
||||||
from helpers.storage_object_info import LockObjectInfo, StorageObjectInfo
|
from helpers.storage_object_info import LockObjectInfo, StorageObjectInfo
|
||||||
|
@ -321,7 +322,7 @@ class TestObjectLockWithGrpc(ClusterTestBase):
|
||||||
self.cluster.default_rpc_endpoint,
|
self.cluster.default_rpc_endpoint,
|
||||||
)
|
)
|
||||||
|
|
||||||
@wait_for_success(parse_time(STORAGE_GC_TIME))
|
@wait_for_success(datetime_utils.parse_time(STORAGE_GC_TIME))
|
||||||
def check_object_not_found():
|
def check_object_not_found():
|
||||||
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
with pytest.raises(Exception, match=OBJECT_NOT_FOUND):
|
||||||
head_object(
|
head_object(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
|
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
|
||||||
from python_keywords.acl import (
|
from python_keywords.acl import (
|
||||||
EACLAccess,
|
EACLAccess,
|
||||||
|
@ -17,7 +18,6 @@ from python_keywords.acl import (
|
||||||
sign_bearer,
|
sign_bearer,
|
||||||
wait_for_cache_expired,
|
wait_for_cache_expired,
|
||||||
)
|
)
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ import os
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from epoch import get_epoch, tick_epoch
|
from epoch import get_epoch
|
||||||
from file_helper import generate_file, get_file_hash
|
from file_helper import generate_file, get_file_hash
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import put_object_to_random_node
|
from python_keywords.frostfs_verbs import put_object_to_random_node
|
||||||
from python_keywords.http_gate import (
|
from python_keywords.http_gate import (
|
||||||
|
@ -19,7 +20,6 @@ from python_keywords.http_gate import (
|
||||||
upload_via_http_gate_curl,
|
upload_via_http_gate_curl,
|
||||||
)
|
)
|
||||||
from utility import wait_for_gc_pass_on_storage_nodes
|
from utility import wait_for_gc_pass_on_storage_nodes
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ from container import (
|
||||||
list_containers,
|
list_containers,
|
||||||
wait_for_container_deletion,
|
wait_for_container_deletion,
|
||||||
)
|
)
|
||||||
from epoch import tick_epoch
|
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from http_gate import (
|
from http_gate import (
|
||||||
attr_into_str_header_curl,
|
attr_into_str_header_curl,
|
||||||
get_object_by_attr_and_verify_hashes,
|
get_object_by_attr_and_verify_hashes,
|
||||||
|
@ -20,7 +20,6 @@ from http_gate import (
|
||||||
)
|
)
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.frostfs_verbs import delete_object
|
from python_keywords.frostfs_verbs import delete_object
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from helpers.storage_object_info import StorageObjectInfo
|
from helpers.storage_object_info import StorageObjectInfo
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from http_gate import (
|
from http_gate import (
|
||||||
get_object_and_verify_hashes,
|
get_object_and_verify_hashes,
|
||||||
get_object_by_attr_and_verify_hashes,
|
get_object_by_attr_and_verify_hashes,
|
||||||
try_to_get_object_via_passed_request_and_expect_error,
|
try_to_get_object_via_passed_request_and_expect_error,
|
||||||
)
|
)
|
||||||
from python_keywords.frostfs_verbs import put_object_to_random_node
|
from python_keywords.frostfs_verbs import put_object_to_random_node
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
|
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import pytest
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from epoch import get_epoch, wait_for_epochs_align
|
from epoch import get_epoch, wait_for_epochs_align
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from grpc_responses import OBJECT_NOT_FOUND
|
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL
|
||||||
from http_gate import (
|
from http_gate import (
|
||||||
attr_into_str_header_curl,
|
attr_into_str_header_curl,
|
||||||
get_object_and_verify_hashes,
|
get_object_and_verify_hashes,
|
||||||
|
@ -20,7 +20,6 @@ from python_keywords.frostfs_verbs import (
|
||||||
get_object_from_random_node,
|
get_object_from_random_node,
|
||||||
head_object,
|
head_object,
|
||||||
)
|
)
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
|
|
||||||
|
@ -29,10 +28,10 @@ EXPIRATION_TIMESTAMP_HEADER = "__FROSRFS__EXPIRATION_TIMESTAMP"
|
||||||
EXPIRATION_EPOCH_HEADER = "__FROSRFS__EXPIRATION_EPOCH"
|
EXPIRATION_EPOCH_HEADER = "__FROSRFS__EXPIRATION_EPOCH"
|
||||||
EXPIRATION_DURATION_HEADER = "__FROSRFS__EXPIRATION_DURATION"
|
EXPIRATION_DURATION_HEADER = "__FROSRFS__EXPIRATION_DURATION"
|
||||||
EXPIRATION_EXPIRATION_RFC = "__FROSRFS__EXPIRATION_RFC3339"
|
EXPIRATION_EXPIRATION_RFC = "__FROSRFS__EXPIRATION_RFC3339"
|
||||||
FROSRFS_EXPIRATION_EPOCH = "Frostfs-Expiration-Epoch"
|
FROSTFS_EXPIRATION_EPOCH = "Frostfs-Expiration-Epoch"
|
||||||
FROSRFS_EXPIRATION_DURATION = "Frostfs-Expiration-Duration"
|
FROSTFS_EXPIRATION_DURATION = "Frostfs-Expiration-Duration"
|
||||||
FROSRFS_EXPIRATION_TIMESTAMP = "Frostfs-Expiration-Timestamp"
|
FROSTFS_EXPIRATION_TIMESTAMP = "Frostfs-Expiration-Timestamp"
|
||||||
FROSRFS_EXIPRATION_RFC3339 = "Frostfs-Expiration-RFC3339"
|
FROSTFS_EXPIRATION_RFC3339 = "Frostfs-Expiration-RFC3339"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
|
@ -324,7 +323,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
FROSTFS_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp(
|
FROSTFS_EXPIRATION_TIMESTAMP: self.epoch_count_into_timestamp(
|
||||||
epoch_duration=epoch_duration, epoch=2
|
epoch_duration=epoch_duration, epoch=2
|
||||||
),
|
),
|
||||||
FROSTFS_EXIPRATION_RFC3339: self.epoch_count_into_timestamp(
|
FROSTFS_EXPIRATION_RFC3339: self.epoch_count_into_timestamp(
|
||||||
epoch_duration=epoch_duration, epoch=1, rfc3339=True
|
epoch_duration=epoch_duration, epoch=1, rfc3339=True
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
@ -373,7 +372,7 @@ class Test_http_system_header(ClusterTestBase):
|
||||||
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
|
f"epoch duration={epoch_duration}, current_epoch= {get_epoch(self.shell, self.cluster)} expected_epoch {expected_epoch}"
|
||||||
)
|
)
|
||||||
attributes = {
|
attributes = {
|
||||||
FROSTFS_EXIPRATION_RFC3339: self.epoch_count_into_timestamp(
|
FROSTFS_EXPIRATION_RFC3339: self.epoch_count_into_timestamp(
|
||||||
epoch_duration=epoch_duration, epoch=2, rfc3339=True
|
epoch_duration=epoch_duration, epoch=2, rfc3339=True
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,8 @@ import allure
|
||||||
import pytest
|
import pytest
|
||||||
from aws_cli_client import AwsCliClient
|
from aws_cli_client import AwsCliClient
|
||||||
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
|
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
|
||||||
from data_formatters import get_wallet_public_key
|
|
||||||
from file_helper import concat_files, generate_file, generate_file_with_content, get_file_hash
|
from file_helper import concat_files, generate_file, generate_file_with_content, get_file_hash
|
||||||
from frostfs_testlib.utils.wallet import init_wallet
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from python_keywords.payment_neogo import deposit_gas, transfer_gas
|
from python_keywords.payment_neogo import deposit_gas, transfer_gas
|
||||||
from s3_helper import (
|
from s3_helper import (
|
||||||
assert_object_lock_mode,
|
assert_object_lock_mode,
|
||||||
|
@ -661,10 +660,10 @@ class TestS3GateObject(TestS3GateBase):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def prepare_two_wallets(self, default_wallet, client_shell):
|
def prepare_two_wallets(self, default_wallet, client_shell):
|
||||||
self.main_wallet = default_wallet
|
self.main_wallet = default_wallet
|
||||||
self.main_public_key = get_wallet_public_key(self.main_wallet, WALLET_PASS)
|
self.main_public_key = wallet_utils.get_wallet_public_key(self.main_wallet, WALLET_PASS)
|
||||||
self.other_wallet = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
self.other_wallet = os.path.join(os.getcwd(), ASSETS_DIR, f"{str(uuid.uuid4())}.json")
|
||||||
init_wallet(self.other_wallet, WALLET_PASS)
|
wallet_utils.init_wallet(self.other_wallet, WALLET_PASS)
|
||||||
self.other_public_key = get_wallet_public_key(self.other_wallet, WALLET_PASS)
|
self.other_public_key = wallet_utils.get_wallet_public_key(self.other_wallet, WALLET_PASS)
|
||||||
|
|
||||||
if not FREE_STORAGE:
|
if not FREE_STORAGE:
|
||||||
main_chain = self.cluster.main_chain_nodes[0]
|
main_chain = self.cluster.main_chain_nodes[0]
|
||||||
|
|
|
@ -5,8 +5,8 @@ import pytest
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
from common import WALLET_PASS
|
from common import WALLET_PASS
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from frostfs_testlib.utils.wallet import get_last_address_from_wallet
|
from frostfs_testlib.resources.common import SESSION_NOT_FOUND
|
||||||
from grpc_responses import SESSION_NOT_FOUND
|
from frostfs_testlib.utils import wallet_utils
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import delete_object, put_object, put_object_to_random_node
|
from python_keywords.frostfs_verbs import delete_object, put_object, put_object_to_random_node
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class TestDynamicObjectSession(ClusterTestBase):
|
||||||
|
|
||||||
with allure.step("Init wallet"):
|
with allure.step("Init wallet"):
|
||||||
wallet = default_wallet
|
wallet = default_wallet
|
||||||
address = get_last_address_from_wallet(wallet, "")
|
address = wallet_utils.get_last_address_from_wallet(wallet, "")
|
||||||
|
|
||||||
with allure.step("Nodes Settlements"):
|
with allure.step("Nodes Settlements"):
|
||||||
(
|
(
|
||||||
|
|
|
@ -6,13 +6,13 @@ from cluster import Cluster
|
||||||
from cluster_test_base import ClusterTestBase
|
from cluster_test_base import ClusterTestBase
|
||||||
from epoch import ensure_fresh_epoch
|
from epoch import ensure_fresh_epoch
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.resources.common import (
|
||||||
from grpc_responses import (
|
|
||||||
EXPIRED_SESSION_TOKEN,
|
EXPIRED_SESSION_TOKEN,
|
||||||
MALFORMED_REQUEST,
|
MALFORMED_REQUEST,
|
||||||
OBJECT_ACCESS_DENIED,
|
OBJECT_ACCESS_DENIED,
|
||||||
OBJECT_NOT_FOUND,
|
OBJECT_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
from frostfs_testlib.shell import Shell
|
||||||
from pytest import FixtureRequest
|
from pytest import FixtureRequest
|
||||||
from python_keywords.container import create_container
|
from python_keywords.container import create_container
|
||||||
from python_keywords.frostfs_verbs import (
|
from python_keywords.frostfs_verbs import (
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from file_helper import generate_file
|
from file_helper import generate_file
|
||||||
|
from frostfs_testlib.resources.common import PUBLIC_ACL
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from python_keywords.acl import (
|
from python_keywords.acl import (
|
||||||
EACLAccess,
|
EACLAccess,
|
||||||
|
@ -19,7 +20,6 @@ from python_keywords.container import (
|
||||||
)
|
)
|
||||||
from python_keywords.object_access import can_put_object
|
from python_keywords.object_access import can_put_object
|
||||||
from wallet import WalletFile
|
from wallet import WalletFile
|
||||||
from wellknown_acl import PUBLIC_ACL
|
|
||||||
|
|
||||||
from steps.cluster_test_base import ClusterTestBase
|
from steps.cluster_test_base import ClusterTestBase
|
||||||
from steps.session_token import ContainerVerb, get_container_signed_token
|
from steps.session_token import ContainerVerb, get_container_signed_token
|
||||||
|
|
|
@ -30,7 +30,7 @@ mmh3==3.0.0
|
||||||
multidict==6.0.2
|
multidict==6.0.2
|
||||||
mypy==0.950
|
mypy==0.950
|
||||||
mypy-extensions==0.4.3
|
mypy-extensions==0.4.3
|
||||||
frostfs-testlib==1.2.0
|
frostfs-testlib==1.3.1
|
||||||
netaddr==0.8.0
|
netaddr==0.8.0
|
||||||
packaging==21.3
|
packaging==21.3
|
||||||
paramiko==2.10.3
|
paramiko==2.10.3
|
||||||
|
|
|
@ -11,9 +11,9 @@ from typing import Any, Dict, List, Optional, Union
|
||||||
import allure
|
import allure
|
||||||
import base58
|
import base58
|
||||||
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||||
from data_formatters import get_wallet_public_key
|
|
||||||
from frostfs_testlib.cli import FrostfsCli
|
from frostfs_testlib.cli import FrostfsCli
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
|
from frostfs_testlib.utils import wallet_utils
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
EACL_LIFETIME = 100500
|
EACL_LIFETIME = 100500
|
||||||
|
@ -110,7 +110,7 @@ class EACLRule:
|
||||||
role = (
|
role = (
|
||||||
self.role.value
|
self.role.value
|
||||||
if isinstance(self.role, EACLRole)
|
if isinstance(self.role, EACLRole)
|
||||||
else f'pubkey:{get_wallet_public_key(self.role, "")}'
|
else f'pubkey:{wallet_utils.get_wallet_public_key(self.role, "")}'
|
||||||
)
|
)
|
||||||
return f'{self.access.value} {self.operation.value} {self.filters or ""} {role}'
|
return f'{self.access.value} {self.operation.value} {self.filters or ""} {role}'
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ def eacl_rules(access: str, verbs: list, user: str) -> list[str]:
|
||||||
(list): a list of eACL rules
|
(list): a list of eACL rules
|
||||||
"""
|
"""
|
||||||
if user not in ("others", "user"):
|
if user not in ("others", "user"):
|
||||||
pubkey = get_wallet_public_key(user, wallet_password="")
|
pubkey = wallet_utils.get_wallet_public_key(user, wallet_password="")
|
||||||
user = f"pubkey:{pubkey}"
|
user = f"pubkey:{pubkey}"
|
||||||
|
|
||||||
rules = []
|
rules = []
|
||||||
|
|
|
@ -10,10 +10,10 @@ from time import sleep
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import json_transformers
|
|
||||||
from common import FROSTFS_CLI_EXEC, WALLET_CONFIG
|
from common import FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||||
from frostfs_testlib.cli import FrostfsCli
|
from frostfs_testlib.cli import FrostfsCli
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
|
from frostfs_testlib.utils import json_utils
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ def get_container(
|
||||||
for attr in container_info["attributes"]:
|
for attr in container_info["attributes"]:
|
||||||
attributes[attr["key"]] = attr["value"]
|
attributes[attr["key"]] = attr["value"]
|
||||||
container_info["attributes"] = attributes
|
container_info["attributes"] = attributes
|
||||||
container_info["ownerID"] = json_transformers.json_reencode(container_info["ownerID"]["value"])
|
container_info["ownerID"] = json_utils.json_reencode(container_info["ownerID"]["value"])
|
||||||
return container_info
|
return container_info
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
import base64
|
|
||||||
import json
|
|
||||||
|
|
||||||
import base58
|
|
||||||
from neo3.wallet import wallet
|
|
||||||
|
|
||||||
|
|
||||||
def dict_to_attrs(attrs: dict) -> str:
|
|
||||||
"""
|
|
||||||
This function takes a dictionary of object's attributes and converts them
|
|
||||||
into string. The string is passed to `--attributes` key of frostfs-cli.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
attrs (dict): object attributes in {"a": "b", "c": "d"} format.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
(str): string in "a=b,c=d" format.
|
|
||||||
"""
|
|
||||||
return ",".join(f"{key}={value}" for key, value in attrs.items())
|
|
||||||
|
|
||||||
|
|
||||||
def __fix_wallet_schema(wallet: dict) -> None:
|
|
||||||
# Temporary function to fix wallets that do not conform to the schema
|
|
||||||
# TODO: get rid of it once issue is solved
|
|
||||||
if "name" not in wallet:
|
|
||||||
wallet["name"] = None
|
|
||||||
for account in wallet["accounts"]:
|
|
||||||
if "extra" not in account:
|
|
||||||
account["extra"] = None
|
|
||||||
|
|
||||||
|
|
||||||
def get_wallet_public_key(wallet_path: str, wallet_password: str, format: str = "hex") -> str:
|
|
||||||
# Get public key from wallet file
|
|
||||||
with open(wallet_path, "r") as file:
|
|
||||||
wallet_content = json.load(file)
|
|
||||||
__fix_wallet_schema(wallet_content)
|
|
||||||
|
|
||||||
wallet_from_json = wallet.Wallet.from_json(wallet_content, password=wallet_password)
|
|
||||||
public_key_hex = str(wallet_from_json.accounts[0].public_key)
|
|
||||||
|
|
||||||
# Convert public key to specified format
|
|
||||||
if format == "hex":
|
|
||||||
return public_key_hex
|
|
||||||
if format == "base58":
|
|
||||||
public_key_base58 = base58.b58encode(bytes.fromhex(public_key_hex))
|
|
||||||
return public_key_base58.decode("utf-8")
|
|
||||||
if format == "base64":
|
|
||||||
public_key_base64 = base64.b64encode(bytes.fromhex(public_key_hex))
|
|
||||||
return public_key_base64.decode("utf-8")
|
|
||||||
raise ValueError(f"Invalid public key format: {format}")
|
|
|
@ -13,10 +13,9 @@ from common import (
|
||||||
)
|
)
|
||||||
from frostfs_testlib.cli import FrostfsAdm, FrostfsCli, NeoGo
|
from frostfs_testlib.cli import FrostfsAdm, FrostfsCli, NeoGo
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_testlib.utils.wallet import get_last_address_from_wallet
|
from frostfs_testlib.utils import datetime_utils, wallet_utils
|
||||||
from payment_neogo import get_contract_hash
|
from payment_neogo import get_contract_hash
|
||||||
from test_control import wait_for_success
|
from test_control import wait_for_success
|
||||||
from utility import parse_time
|
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ def tick_epoch(shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode]
|
||||||
# In case if no local_wallet_path is provided, we use wallet_path
|
# In case if no local_wallet_path is provided, we use wallet_path
|
||||||
ir_wallet_path = ir_node.get_wallet_path()
|
ir_wallet_path = ir_node.get_wallet_path()
|
||||||
ir_wallet_pass = ir_node.get_wallet_password()
|
ir_wallet_pass = ir_node.get_wallet_password()
|
||||||
ir_address = get_last_address_from_wallet(ir_wallet_path, ir_wallet_pass)
|
ir_address = wallet_utils.get_last_address_from_wallet(ir_wallet_path, ir_wallet_pass)
|
||||||
|
|
||||||
morph_chain = cluster.morph_chain_nodes[0]
|
morph_chain = cluster.morph_chain_nodes[0]
|
||||||
morph_endpoint = morph_chain.get_endpoint()
|
morph_endpoint = morph_chain.get_endpoint()
|
||||||
|
@ -108,4 +107,4 @@ def tick_epoch(shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode]
|
||||||
force=True,
|
force=True,
|
||||||
gas=1,
|
gas=1,
|
||||||
)
|
)
|
||||||
sleep(parse_time(MAINNET_BLOCK_TIME))
|
sleep(datetime_utils.parse_time(MAINNET_BLOCK_TIME))
|
||||||
|
|
|
@ -6,11 +6,11 @@ import uuid
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import json_transformers
|
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
from common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||||
from frostfs_testlib.cli import FrostfsCli
|
from frostfs_testlib.cli import FrostfsCli
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
|
from frostfs_testlib.utils import json_utils
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -613,22 +613,22 @@ def head_object(
|
||||||
# If response is Complex Object header, it has `splitId` key
|
# If response is Complex Object header, it has `splitId` key
|
||||||
if "splitId" in decoded.keys():
|
if "splitId" in decoded.keys():
|
||||||
logger.info("decoding split header")
|
logger.info("decoding split header")
|
||||||
return json_transformers.decode_split_header(decoded)
|
return json_utils.decode_split_header(decoded)
|
||||||
|
|
||||||
# If response is Last or Linking Object header,
|
# If response is Last or Linking Object header,
|
||||||
# it has `header` dictionary and non-null `split` dictionary
|
# it has `header` dictionary and non-null `split` dictionary
|
||||||
if "split" in decoded["header"].keys():
|
if "split" in decoded["header"].keys():
|
||||||
if decoded["header"]["split"]:
|
if decoded["header"]["split"]:
|
||||||
logger.info("decoding linking object")
|
logger.info("decoding linking object")
|
||||||
return json_transformers.decode_linking_object(decoded)
|
return json_utils.decode_linking_object(decoded)
|
||||||
|
|
||||||
if decoded["header"]["objectType"] == "STORAGE_GROUP":
|
if decoded["header"]["objectType"] == "STORAGE_GROUP":
|
||||||
logger.info("decoding storage group")
|
logger.info("decoding storage group")
|
||||||
return json_transformers.decode_storage_group(decoded)
|
return json_utils.decode_storage_group(decoded)
|
||||||
|
|
||||||
if decoded["header"]["objectType"] == "TOMBSTONE":
|
if decoded["header"]["objectType"] == "TOMBSTONE":
|
||||||
logger.info("decoding tombstone")
|
logger.info("decoding tombstone")
|
||||||
return json_transformers.decode_tombstone(decoded)
|
return json_utils.decode_tombstone(decoded)
|
||||||
|
|
||||||
logger.info("decoding simple header")
|
logger.info("decoding simple header")
|
||||||
return json_transformers.decode_simple_header(decoded)
|
return json_utils.decode_simple_header(decoded)
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
"""
|
|
||||||
When doing requests to FrostFS, we get JSON output as an automatically decoded
|
|
||||||
structure from protobuf. Some fields are decoded with boilerplates and binary
|
|
||||||
values are Base64-encoded.
|
|
||||||
|
|
||||||
This module contains functions which rearrange the structure and reencode binary
|
|
||||||
data from Base64 to Base58.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import base58
|
|
||||||
|
|
||||||
|
|
||||||
def decode_simple_header(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function reencodes Simple Object header and its attributes.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
data = decode_common_fields(data)
|
|
||||||
|
|
||||||
# Normalize object attributes
|
|
||||||
data["header"]["attributes"] = {
|
|
||||||
attr["key"]: attr["value"] for attr in data["header"]["attributes"]
|
|
||||||
}
|
|
||||||
except Exception as exc:
|
|
||||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def decode_split_header(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function rearranges Complex Object header.
|
|
||||||
The header holds SplitID, a random unique
|
|
||||||
number, which is common among all splitted objects, and IDs of the Linking
|
|
||||||
Object and the last splitted Object.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
data["splitId"] = json_reencode(data["splitId"])
|
|
||||||
data["lastPart"] = json_reencode(data["lastPart"]["value"]) if data["lastPart"] else None
|
|
||||||
data["link"] = json_reencode(data["link"]["value"]) if data["link"] else None
|
|
||||||
except Exception as exc:
|
|
||||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def decode_linking_object(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function reencodes Linking Object header.
|
|
||||||
It contains IDs of child Objects and Split Chain data.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
data = decode_simple_header(data)
|
|
||||||
split = data["header"]["split"]
|
|
||||||
split["children"] = [json_reencode(item["value"]) for item in split["children"]]
|
|
||||||
split["splitID"] = json_reencode(split["splitID"])
|
|
||||||
split["previous"] = json_reencode(split["previous"]["value"]) if split["previous"] else None
|
|
||||||
split["parent"] = json_reencode(split["parent"]["value"]) if split["parent"] else None
|
|
||||||
except Exception as exc:
|
|
||||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def decode_storage_group(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function reencodes Storage Group header.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
data = decode_common_fields(data)
|
|
||||||
except Exception as exc:
|
|
||||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def decode_tombstone(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function reencodes Tombstone header.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
data = decode_simple_header(data)
|
|
||||||
data["header"]["sessionToken"] = decode_session_token(data["header"]["sessionToken"])
|
|
||||||
except Exception as exc:
|
|
||||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def decode_session_token(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
This function reencodes a fragment of header which contains
|
|
||||||
information about session token.
|
|
||||||
"""
|
|
||||||
target = data["body"]["object"]["target"]
|
|
||||||
target["container"] = json_reencode(target["container"]["value"])
|
|
||||||
target["objects"] = [json_reencode(obj["value"]) for obj in target["objects"]]
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def json_reencode(data: str) -> str:
|
|
||||||
"""
|
|
||||||
According to JSON protocol, binary data (Object/Container/Storage Group IDs, etc)
|
|
||||||
is converted to string via Base58 encoder. But we usually operate with Base64-encoded format.
|
|
||||||
This function reencodes given Base58 string into the Base64 one.
|
|
||||||
"""
|
|
||||||
return base58.b58encode(base64.b64decode(data)).decode("utf-8")
|
|
||||||
|
|
||||||
|
|
||||||
def encode_for_json(data: str) -> str:
|
|
||||||
"""
|
|
||||||
This function encodes binary data for sending them as protobuf
|
|
||||||
structures.
|
|
||||||
"""
|
|
||||||
return base64.b64encode(base58.b58decode(data)).decode("utf-8")
|
|
||||||
|
|
||||||
|
|
||||||
def decode_common_fields(data: dict) -> dict:
|
|
||||||
"""
|
|
||||||
Despite of type (simple/complex Object, Storage Group, etc) every Object
|
|
||||||
header contains several common fields.
|
|
||||||
This function rearranges these fields.
|
|
||||||
"""
|
|
||||||
data["objectID"] = json_reencode(data["objectID"]["value"])
|
|
||||||
|
|
||||||
header = data["header"]
|
|
||||||
header["containerID"] = json_reencode(header["containerID"]["value"])
|
|
||||||
header["ownerID"] = json_reencode(header["ownerID"]["value"])
|
|
||||||
header["payloadHash"] = json_reencode(header["payloadHash"]["sum"])
|
|
||||||
header["version"] = f"{header['version']['major']}{header['version']['minor']}"
|
|
||||||
# Homomorphic hash is optional and its calculation might be disabled in trusted network
|
|
||||||
if header.get("homomorphicHash"):
|
|
||||||
header["homomorphicHash"] = json_reencode(header["homomorphicHash"]["sum"])
|
|
||||||
|
|
||||||
return data
|
|
|
@ -11,7 +11,7 @@ from common import FROSTFS_CLI_EXEC, MORPH_BLOCK_TIME
|
||||||
from epoch import tick_epoch
|
from epoch import tick_epoch
|
||||||
from frostfs_testlib.cli import FrostfsCli
|
from frostfs_testlib.cli import FrostfsCli
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from utility import parse_time
|
from frostfs_testlib.utils import datetime_utils
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ def drop_object(node: StorageNode, cid: str, oid: str) -> str:
|
||||||
def delete_node_data(node: StorageNode) -> None:
|
def delete_node_data(node: StorageNode) -> None:
|
||||||
node.stop_service()
|
node.stop_service()
|
||||||
node.host.delete_storage_node_data(node.name)
|
node.host.delete_storage_node_data(node.name)
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME))
|
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
|
||||||
|
|
||||||
|
|
||||||
@allure.step("Exclude node {node_to_exclude} from network map")
|
@allure.step("Exclude node {node_to_exclude} from network map")
|
||||||
|
@ -168,7 +168,7 @@ def exclude_node_from_network_map(
|
||||||
|
|
||||||
storage_node_set_status(node_to_exclude, status="offline")
|
storage_node_set_status(node_to_exclude, status="offline")
|
||||||
|
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME))
|
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
|
||||||
tick_epoch(shell, cluster)
|
tick_epoch(shell, cluster)
|
||||||
|
|
||||||
snapshot = get_netmap_snapshot(node=alive_node, shell=shell)
|
snapshot = get_netmap_snapshot(node=alive_node, shell=shell)
|
||||||
|
@ -189,9 +189,9 @@ def include_node_to_network_map(
|
||||||
# Per suggestion of @fyrchik we need to wait for 2 blocks after we set status and after tick epoch.
|
# Per suggestion of @fyrchik we need to wait for 2 blocks after we set status and after tick epoch.
|
||||||
# First sleep can be omitted after https://github.com/nspcc-dev/frostfs-node/issues/1790 complete.
|
# First sleep can be omitted after https://github.com/nspcc-dev/frostfs-node/issues/1790 complete.
|
||||||
|
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME) * 2)
|
||||||
tick_epoch(shell, cluster)
|
tick_epoch(shell, cluster)
|
||||||
time.sleep(parse_time(MORPH_BLOCK_TIME) * 2)
|
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME) * 2)
|
||||||
|
|
||||||
check_node_in_map(node_to_include, shell, alive_node)
|
check_node_in_map(node_to_include, shell, alive_node)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ from typing import Optional
|
||||||
import allure
|
import allure
|
||||||
from cluster import Cluster
|
from cluster import Cluster
|
||||||
from file_helper import get_file_hash
|
from file_helper import get_file_hash
|
||||||
|
from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from grpc_responses import OBJECT_ACCESS_DENIED, error_matches_status
|
from frostfs_testlib.utils import string_utils
|
||||||
from python_keywords.frostfs_verbs import (
|
from python_keywords.frostfs_verbs import (
|
||||||
delete_object,
|
delete_object,
|
||||||
get_object_from_random_node,
|
get_object_from_random_node,
|
||||||
|
@ -42,7 +43,7 @@ def can_get_object(
|
||||||
cluster=cluster,
|
cluster=cluster,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -75,7 +76,7 @@ def can_put_object(
|
||||||
cluster=cluster,
|
cluster=cluster,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -105,7 +106,7 @@ def can_delete_object(
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -135,7 +136,7 @@ def can_get_head_object(
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -166,7 +167,7 @@ def can_get_range_of_object(
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -197,7 +198,7 @@ def can_get_range_hash_of_object(
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
@ -226,7 +227,7 @@ def can_search_object(
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
)
|
)
|
||||||
except OPERATION_ERROR_TYPE as err:
|
except OPERATION_ERROR_TYPE as err:
|
||||||
assert error_matches_status(
|
assert string_utils.is_str_match_pattern(
|
||||||
err, OBJECT_ACCESS_DENIED
|
err, OBJECT_ACCESS_DENIED
|
||||||
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -10,11 +10,9 @@ from cluster import MainChain, MorphChain
|
||||||
from common import FROSTFS_CONTRACT, GAS_HASH, MAINNET_BLOCK_TIME, NEOGO_EXECUTABLE
|
from common import FROSTFS_CONTRACT, GAS_HASH, MAINNET_BLOCK_TIME, NEOGO_EXECUTABLE
|
||||||
from frostfs_testlib.cli import NeoGo
|
from frostfs_testlib.cli import NeoGo
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_testlib.utils.converters import contract_hash_to_address
|
from frostfs_testlib.utils import converting_utils, datetime_utils, wallet_utils
|
||||||
from frostfs_testlib.utils.wallet import get_last_address_from_wallet
|
|
||||||
from neo3.wallet import utils as neo3_utils
|
from neo3.wallet import utils as neo3_utils
|
||||||
from neo3.wallet import wallet as neo3_wallet
|
from neo3.wallet import wallet as neo3_wallet
|
||||||
from utility import parse_time
|
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -43,7 +41,7 @@ def get_contract_hash(morph_chain: MorphChain, resolve_name: str, shell: Shell)
|
||||||
|
|
||||||
@allure.step("Withdraw Mainnet Gas")
|
@allure.step("Withdraw Mainnet Gas")
|
||||||
def withdraw_mainnet_gas(shell: Shell, main_chain: MainChain, wlt: str, amount: int):
|
def withdraw_mainnet_gas(shell: Shell, main_chain: MainChain, wlt: str, amount: int):
|
||||||
address = get_last_address_from_wallet(wlt, EMPTY_PASSWORD)
|
address = wallet_utils.get_last_address_from_wallet(wlt, EMPTY_PASSWORD)
|
||||||
scripthash = neo3_utils.address_to_script_hash(address)
|
scripthash = neo3_utils.address_to_script_hash(address)
|
||||||
|
|
||||||
neogo = NeoGo(shell=shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
neogo = NeoGo(shell=shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
||||||
|
@ -142,10 +140,12 @@ def transfer_gas(
|
||||||
if wallet_from_password is not None
|
if wallet_from_password is not None
|
||||||
else main_chain.get_wallet_password()
|
else main_chain.get_wallet_password()
|
||||||
)
|
)
|
||||||
address_from = address_from or get_last_address_from_wallet(
|
address_from = address_from or wallet_utils.get_last_address_from_wallet(
|
||||||
wallet_from_path, wallet_from_password
|
wallet_from_path, wallet_from_password
|
||||||
)
|
)
|
||||||
address_to = address_to or get_last_address_from_wallet(wallet_to_path, wallet_to_password)
|
address_to = address_to or wallet_utils.get_last_address_from_wallet(
|
||||||
|
wallet_to_path, wallet_to_password
|
||||||
|
)
|
||||||
|
|
||||||
neogo = NeoGo(shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
neogo = NeoGo(shell, neo_go_exec_path=NEOGO_EXECUTABLE)
|
||||||
out = neogo.nep17.transfer(
|
out = neogo.nep17.transfer(
|
||||||
|
@ -163,7 +163,7 @@ def transfer_gas(
|
||||||
raise Exception("Got no TXID after run the command")
|
raise Exception("Got no TXID after run the command")
|
||||||
if not transaction_accepted(main_chain, txid):
|
if not transaction_accepted(main_chain, txid):
|
||||||
raise AssertionError(f"TX {txid} hasn't been processed")
|
raise AssertionError(f"TX {txid} hasn't been processed")
|
||||||
time.sleep(parse_time(MAINNET_BLOCK_TIME))
|
time.sleep(datetime_utils.parse_time(MAINNET_BLOCK_TIME))
|
||||||
|
|
||||||
|
|
||||||
@allure.step("FrostFS Deposit")
|
@allure.step("FrostFS Deposit")
|
||||||
|
@ -178,9 +178,9 @@ def deposit_gas(
|
||||||
Transferring GAS from given wallet to FrostFS contract address.
|
Transferring GAS from given wallet to FrostFS contract address.
|
||||||
"""
|
"""
|
||||||
# get FrostFS contract address
|
# get FrostFS contract address
|
||||||
deposit_addr = contract_hash_to_address(FROSTFS_CONTRACT)
|
deposit_addr = converting_utils.contract_hash_to_address(FROSTFS_CONTRACT)
|
||||||
logger.info(f"FrostFS contract address: {deposit_addr}")
|
logger.info(f"FrostFS contract address: {deposit_addr}")
|
||||||
address_from = get_last_address_from_wallet(
|
address_from = wallet_utils.get_last_address_from_wallet(
|
||||||
wallet_path=wallet_from_path, wallet_password=wallet_from_password
|
wallet_path=wallet_from_path, wallet_password=wallet_from_password
|
||||||
)
|
)
|
||||||
transfer_gas(
|
transfer_gas(
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import complex_object_actions
|
import complex_object_actions
|
||||||
import frostfs_verbs
|
import frostfs_verbs
|
||||||
from cluster import StorageNode
|
from cluster import StorageNode
|
||||||
|
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from grpc_responses import OBJECT_NOT_FOUND, error_matches_status
|
from frostfs_testlib.utils import string_utils
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ def get_nodes_without_object(
|
||||||
if res is None:
|
if res is None:
|
||||||
nodes_list.append(node)
|
nodes_list.append(node)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if error_matches_status(err, OBJECT_NOT_FOUND):
|
if string_utils.is_str_match_pattern(err, OBJECT_NOT_FOUND):
|
||||||
nodes_list.append(node)
|
nodes_list.append(node)
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Got error {err} on head object command") from err
|
raise Exception(f"Got error {err} on head object command") from err
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# ACLs with final flag
|
|
||||||
PUBLIC_ACL_F = "1FBFBFFF"
|
|
||||||
PRIVATE_ACL_F = "1C8C8CCC"
|
|
||||||
READONLY_ACL_F = "1FBF8CFF"
|
|
||||||
|
|
||||||
# ACLs without final flag set
|
|
||||||
PUBLIC_ACL = "0FBFBFFF"
|
|
||||||
INACCESSIBLE_ACL = "40000000"
|
|
||||||
STICKYBIT_PUB_ACL = "3FFFFFFF"
|
|
||||||
|
|
||||||
EACL_PUBLIC_READ_WRITE = "eacl-public-read-write"
|
|
0
venv/local-pytest/environment.sh
Normal file → Executable file
0
venv/local-pytest/environment.sh
Normal file → Executable file
Loading…
Add table
Reference in a new issue