Change all imports to imports from root and remove robot

Signed-off-by: Aleksei Chetaev <alex.chetaev@gmail.com>
This commit is contained in:
Aleksei Chetaev 2023-02-27 17:54:27 +01:00 committed by Aleksey Chetaev
parent 13bc98eecc
commit 52001dc23a
78 changed files with 674 additions and 636 deletions

2
.gitignore vendored
View file

@ -26,4 +26,4 @@ TemporaryDir/*
artifacts/* artifacts/*
docs/* docs/*
venv.*/* venv.*/*
/*wallet_config.yml wallet_config.yml

View file

@ -2,13 +2,7 @@
Tests written with PyTest Framework are located under `pytest_tests/testsuites` directory. Tests written with PyTest Framework are located under `pytest_tests/testsuites` directory.
These tests rely on resources and utility modules that have been originally developed for Robot Framework: These tests rely on resources and utility modules that have been originally developed for Pytest Framework.
`robot/resources/files` - static files that are used in tests' commands.
`robot/resources/lib/` - common Python libraries that provide utility functions used as building blocks in tests.
`robot/variables/` - constants and configuration variables for tests.
## Testcases execution ## Testcases execution
@ -41,12 +35,12 @@ Note that we expect frostfs-dev-env to be located under
the `<testcases_root_dir>/../frostfs-dev-env` directory. If you put this repo in any other place, the `<testcases_root_dir>/../frostfs-dev-env` directory. If you put this repo in any other place,
manually set the full path to frostfs-dev-env in the environment variable `DEVENV_PATH` at this step. manually set the full path to frostfs-dev-env in the environment variable `DEVENV_PATH` at this step.
5. Make sure you have installed all of the following prerequisites on your machine 5. Make sure you have installed all the following prerequisites on your machine
``` ```
make make
python3.9 python3.10
python3.9-dev python3.10-dev
libssl-dev libssl-dev
``` ```
As we use frostfs-dev-env, you'll also need to install As we use frostfs-dev-env, you'll also need to install

View file

@ -1,8 +1,8 @@
[tool.isort] [tool.isort]
profile = "black" profile = "black"
src_paths = ["pytest_tests", "robot"] src_paths = ["pytest_tests"]
line_length = 100 line_length = 100
[tool.black] [tool.black]
line-length = 100 line-length = 100
target-version = ["py39"] target-version = ["py310"]

View file

@ -10,11 +10,12 @@ 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 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 from frostfs_testlib.utils import wallet_utils
from pytest_tests.resources.common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
EACL_LIFETIME = 100500 EACL_LIFETIME = 100500
FROSTFS_CONTRACT_CACHE_TIMEOUT = 30 FROSTFS_CONTRACT_CACHE_TIMEOUT = 30

View file

@ -5,8 +5,9 @@ from datetime import datetime
from typing import Optional from typing import Optional
import allure import allure
from cli_helpers import _cmd_run
from common import ASSETS_DIR from pytest_tests.helpers.cli_helpers import _cmd_run
from pytest_tests.resources.common import ASSETS_DIR
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
REGULAR_TIMEOUT = 90 REGULAR_TIMEOUT = 90

View file

@ -1,11 +1,12 @@
import logging import logging
import re import re
from common import FROSTFS_ADM_EXEC, FROSTFS_CLI_EXEC, WALLET_CONFIG
from frostfs_testlib.cli import FrostfsAdm, FrostfsCli from frostfs_testlib.cli import FrostfsAdm, FrostfsCli
from frostfs_testlib.hosting import Hosting from frostfs_testlib.hosting import Hosting
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from pytest_tests.resources.common import FROSTFS_ADM_EXEC, FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -14,12 +14,13 @@ import logging
from typing import Optional, Tuple from typing import Optional, Tuple
import allure import allure
import frostfs_verbs
from cluster import Cluster, StorageNode
from common import WALLET_CONFIG
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_verbs import head_object
from storage_object import StorageObjectInfo from pytest_tests.helpers import frostfs_verbs
from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.helpers.frostfs_verbs import head_object
from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from pytest_tests.resources.common import WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,14 +1,23 @@
import json
import logging
from dataclasses import dataclass from dataclasses import dataclass
from typing import Optional from time import sleep
from typing import Optional, Union
import allure import allure
from cluster import Cluster from frostfs_testlib.cli import FrostfsCli
from file_helper import generate_file, get_file_hash
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_verbs import put_object, put_object_to_random_node from frostfs_testlib.utils import json_utils
from storage_object import StorageObjectInfo
from wallet import WalletFile from wallet import WalletFile
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.file_helper import generate_file, get_file_hash
from pytest_tests.helpers.frostfs_verbs import put_object, put_object_to_random_node
from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from pytest_tests.resources.common import FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger")
@dataclass @dataclass
class StorageContainerInfo: class StorageContainerInfo:
@ -85,3 +94,225 @@ class StorageContainer:
) )
return storage_object return storage_object
DEFAULT_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X"
SINGLE_PLACEMENT_RULE = "REP 1 IN X CBF 1 SELECT 4 FROM * AS X"
REP_2_FOR_3_NODES_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 3 FROM * AS X"
@allure.step("Create Container")
def create_container(
wallet: str,
shell: Shell,
endpoint: str,
rule: str = DEFAULT_PLACEMENT_RULE,
basic_acl: str = "",
attributes: Optional[dict] = None,
session_token: str = "",
session_wallet: str = "",
name: str = None,
options: dict = None,
await_mode: bool = True,
wait_for_creation: bool = True,
) -> str:
"""
A wrapper for `frostfs-cli container create` call.
Args:
wallet (str): a wallet on whose behalf a container is created
rule (optional, str): placement rule for container
basic_acl (optional, str): an ACL for container, will be
appended to `--basic-acl` key
attributes (optional, dict): container attributes , will be
appended to `--attributes` key
session_token (optional, str): a path to session token file
session_wallet(optional, str): a path to the wallet which signed
the session token; this parameter makes sense
when paired with `session_token`
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
options (optional, dict): any other options to pass to the call
name (optional, str): container name attribute
await_mode (bool): block execution until container is persisted
wait_for_creation (): Wait for container shows in container list
Returns:
(str): CID of the created container
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.create(
rpc_endpoint=endpoint,
wallet=session_wallet if session_wallet else wallet,
policy=rule,
basic_acl=basic_acl,
attributes=attributes,
name=name,
session=session_token,
await_mode=await_mode,
**options or {},
)
cid = _parse_cid(result.stdout)
logger.info("Container created; waiting until it is persisted in the sidechain")
if wait_for_creation:
wait_for_container_creation(wallet, cid, shell, endpoint)
return cid
def wait_for_container_creation(
wallet: str, cid: str, shell: Shell, endpoint: str, attempts: int = 15, sleep_interval: int = 1
):
for _ in range(attempts):
containers = list_containers(wallet, shell, endpoint)
if cid in containers:
return
logger.info(f"There is no {cid} in {containers} yet; sleep {sleep_interval} and continue")
sleep(sleep_interval)
raise RuntimeError(
f"After {attempts * sleep_interval} seconds container {cid} hasn't been persisted; exiting"
)
def wait_for_container_deletion(
wallet: str, cid: str, shell: Shell, endpoint: str, attempts: int = 30, sleep_interval: int = 1
):
for _ in range(attempts):
try:
get_container(wallet, cid, shell=shell, endpoint=endpoint)
sleep(sleep_interval)
continue
except Exception as err:
if "container not found" not in str(err):
raise AssertionError(f'Expected "container not found" in error, got\n{err}')
return
raise AssertionError(f"Expected container deleted during {attempts * sleep_interval} sec.")
@allure.step("List Containers")
def list_containers(wallet: str, shell: Shell, endpoint: str) -> list[str]:
"""
A wrapper for `frostfs-cli container list` call. It returns all the
available containers for the given wallet.
Args:
wallet (str): a wallet on whose behalf we list the containers
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
Returns:
(list): list of containers
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.list(rpc_endpoint=endpoint, wallet=wallet)
logger.info(f"Containers: \n{result}")
return result.stdout.split()
@allure.step("Get Container")
def get_container(
wallet: str,
cid: str,
shell: Shell,
endpoint: str,
json_mode: bool = True,
) -> Union[dict, str]:
"""
A wrapper for `frostfs-cli container get` call. It extracts container's
attributes and rearranges them into a more compact view.
Args:
wallet (str): path to a wallet on whose behalf we get the container
cid (str): ID of the container to get
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
json_mode (bool): return container in JSON format
Returns:
(dict, str): dict of container attributes
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.get(rpc_endpoint=endpoint, wallet=wallet, cid=cid, json_mode=json_mode)
if not json_mode:
return result.stdout
container_info = json.loads(result.stdout)
attributes = dict()
for attr in container_info["attributes"]:
attributes[attr["key"]] = attr["value"]
container_info["attributes"] = attributes
container_info["ownerID"] = json_utils.json_reencode(container_info["ownerID"]["value"])
return container_info
@allure.step("Delete Container")
# TODO: make the error message about a non-found container more user-friendly
# https://github.com/nspcc-dev/frostfs-contract/issues/121
def delete_container(
wallet: str,
cid: str,
shell: Shell,
endpoint: str,
force: bool = False,
session_token: Optional[str] = None,
await_mode: bool = False,
) -> None:
"""
A wrapper for `frostfs-cli container delete` call.
Args:
wallet (str): path to a wallet on whose behalf we delete the container
cid (str): ID of the container to delete
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
force (bool): do not check whether container contains locks and remove immediately
session_token: a path to session token file
This function doesn't return anything.
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
cli.container.delete(
wallet=wallet,
cid=cid,
rpc_endpoint=endpoint,
force=force,
session=session_token,
await_mode=await_mode,
)
def _parse_cid(output: str) -> str:
"""
Parses container ID from a given CLI output. The input string we expect:
container ID: 2tz86kVTDpJxWHrhw3h6PbKMwkLtBEwoqhHQCKTre1FN
awaiting...
container has been persisted on sidechain
We want to take 'container ID' value from the string.
Args:
output (str): CLI output to parse
Returns:
(str): extracted CID
"""
try:
# taking first line from command's output
first_line = output.split("\n")[0]
except Exception:
first_line = ""
logger.error(f"Got empty output: {output}")
splitted = first_line.split(": ")
if len(splitted) != 2:
raise ValueError(f"no CID was parsed from command output: \t{first_line}")
return splitted[1]
@allure.step("Search container by name")
def search_container_by_name(wallet: str, name: str, shell: Shell, endpoint: str):
list_cids = list_containers(wallet, shell, endpoint)
for cid in list_cids:
cont_info = get_container(wallet, cid, shell, endpoint, True)
if cont_info.get("attributes").get("Name", None) == name:
return cid
return None

View file

@ -1,9 +1,10 @@
from typing import List, Optional from typing import List, Optional
from acl import EACLOperation
from cluster import Cluster
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from python_keywords.object_access import (
from pytest_tests.helpers.acl import EACLOperation
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.object_access import (
can_delete_object, can_delete_object,
can_get_head_object, can_get_head_object,
can_get_object, can_get_object,

View file

@ -3,19 +3,20 @@ from time import sleep
from typing import Optional from typing import Optional
import allure import allure
from cluster import Cluster, StorageNode from frostfs_testlib.cli import FrostfsAdm, FrostfsCli, NeoGo
from common import ( from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import datetime_utils, wallet_utils
from payment_neogo import get_contract_hash
from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.helpers.test_control import wait_for_success
from pytest_tests.resources.common import (
FROSTFS_ADM_CONFIG_PATH, FROSTFS_ADM_CONFIG_PATH,
FROSTFS_ADM_EXEC, FROSTFS_ADM_EXEC,
FROSTFS_CLI_EXEC, FROSTFS_CLI_EXEC,
MAINNET_BLOCK_TIME, MAINNET_BLOCK_TIME,
NEOGO_EXECUTABLE, NEOGO_EXECUTABLE,
) )
from frostfs_testlib.cli import FrostfsAdm, FrostfsCli, NeoGo
from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import datetime_utils, wallet_utils
from payment_neogo import get_contract_hash
from test_control import wait_for_success
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -2,10 +2,11 @@ import logging
from time import sleep from time import sleep
import allure import allure
from cluster import Cluster, StorageNode
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from python_keywords.node_management import storage_node_healthcheck
from storage_policy import get_nodes_with_object from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.helpers.node_management import storage_node_healthcheck
from pytest_tests.helpers.storage_policy import get_nodes_with_object
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -5,7 +5,8 @@ import uuid
from typing import Any, Optional from typing import Any, Optional
import allure import allure
from common import ASSETS_DIR
from pytest_tests.resources.common import ASSETS_DIR
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -6,12 +6,13 @@ import uuid
from typing import Any, Optional from typing import Any, Optional
import allure import allure
from cluster import Cluster
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 from frostfs_testlib.utils import json_utils
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.resources.common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,4 +1,3 @@
import base64
import logging import logging
import os import os
import random import random
@ -12,13 +11,14 @@ from urllib.parse import quote_plus
import allure import allure
import requests import requests
from aws_cli_client import LONG_TIMEOUT from aws_cli_client import LONG_TIMEOUT
from cli_helpers import _cmd_run
from cluster import StorageNode
from common import SIMPLE_OBJECT_SIZE
from file_helper import get_file_hash
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from python_keywords.frostfs_verbs import get_object
from python_keywords.storage_policy import get_nodes_without_object from pytest_tests.helpers.cli_helpers import _cmd_run
from pytest_tests.helpers.cluster import StorageNode
from pytest_tests.helpers.file_helper import get_file_hash
from pytest_tests.helpers.frostfs_verbs import get_object
from pytest_tests.helpers.storage_policy import get_nodes_without_object
from pytest_tests.resources.common import SIMPLE_OBJECT_SIZE
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -6,13 +6,14 @@ from dataclasses import dataclass
from typing import Optional from typing import Optional
import allure import allure
from cluster import Cluster, StorageNode
from common import FROSTFS_CLI_EXEC, MORPH_BLOCK_TIME
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 frostfs_testlib.utils import datetime_utils from frostfs_testlib.utils import datetime_utils
from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.helpers.epoch import tick_epoch
from pytest_tests.resources.common import FROSTFS_CLI_EXEC, MORPH_BLOCK_TIME
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,12 +1,13 @@
from typing import Optional from typing import Optional
import allure import allure
from cluster import Cluster
from file_helper import get_file_hash
from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import string_utils from frostfs_testlib.utils import string_utils
from python_keywords.frostfs_verbs import (
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.file_helper import get_file_hash
from pytest_tests.helpers.frostfs_verbs import (
delete_object, delete_object,
get_object_from_random_node, get_object_from_random_node,
get_range, get_range,
@ -30,7 +31,7 @@ def can_get_object(
wallet_config: Optional[str] = None, wallet_config: Optional[str] = None,
xhdr: Optional[dict] = None, xhdr: Optional[dict] = None,
) -> bool: ) -> bool:
with allure.step("Try get object from container"): with allure.step("Try get object from pytest_tests.helpers.container"):
try: try:
got_file_path = get_object_from_random_node( got_file_path = get_object_from_random_node(
wallet, wallet,
@ -93,7 +94,7 @@ def can_delete_object(
wallet_config: Optional[str] = None, wallet_config: Optional[str] = None,
xhdr: Optional[dict] = None, xhdr: Optional[dict] = None,
) -> bool: ) -> bool:
with allure.step("Try delete object from container"): with allure.step("Try delete object from pytest_tests.helpers.container"):
try: try:
delete_object( delete_object(
wallet, wallet,

View file

@ -6,14 +6,20 @@ import time
from typing import Optional from typing import Optional
import allure import allure
from cluster import MainChain, MorphChain
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 import converting_utils, datetime_utils, wallet_utils from frostfs_testlib.utils import converting_utils, datetime_utils, wallet_utils
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 pytest_tests.helpers.cluster import MainChain, MorphChain
from pytest_tests.resources.common import (
FROSTFS_CONTRACT,
GAS_HASH,
MAINNET_BLOCK_TIME,
NEOGO_EXECUTABLE,
)
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
EMPTY_PASSWORD = "" EMPTY_PASSWORD = ""

View file

@ -1,14 +1,13 @@
import datetime
import logging import logging
import os import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Optional from typing import Optional
import allure import allure
import s3_gate_bucket
import s3_gate_object
from dateutil.parser import parse from dateutil.parser import parse
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -6,12 +6,13 @@ import logging
from typing import Optional from typing import Optional
import allure import allure
from cluster import Cluster
from common import FROSTFS_CLI_EXEC, WALLET_CONFIG
from complex_object_actions import get_link_object
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_verbs import head_object
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.complex_object_actions import get_link_object
from pytest_tests.helpers.frostfs_verbs import head_object
from pytest_tests.resources.common import FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -8,13 +8,13 @@
import logging import logging
import allure import allure
import complex_object_actions
import frostfs_verbs
from cluster import StorageNode
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND from frostfs_testlib.resources.common import OBJECT_NOT_FOUND
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import string_utils from frostfs_testlib.utils import string_utils
from pytest_tests.helpers import complex_object_actions, frostfs_verbs
from pytest_tests.helpers.cluster import StorageNode
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -3,9 +3,10 @@ import logging
import allure import allure
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_verbs import head_object
from neo3.wallet import wallet from neo3.wallet import wallet
from pytest_tests.helpers.frostfs_verbs import head_object
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,13 +1,14 @@
import time import time
import allure import allure
from common import STORAGE_GC_TIME
from frostfs_testlib.utils import datetime_utils from frostfs_testlib.utils import datetime_utils
from pytest_tests.resources.common import STORAGE_GC_TIME
def placement_policy_from_container(container_info: str) -> str: def placement_policy_from_container(container_info: str) -> str:
""" """
Get placement policy from container info: Get placement policy from pytest_tests.helpers.container info:
container ID: j7k4auNHRmiPMSmnH2qENLECD2au2y675fvTX6csDwd container ID: j7k4auNHRmiPMSmnH2qENLECD2au2y675fvTX6csDwd
version: 2.12 version: 2.12

View file

@ -2,11 +2,12 @@ import os
import uuid import uuid
from dataclasses import dataclass from dataclasses import dataclass
from cluster import Cluster, NodeBase
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 import wallet_utils from frostfs_testlib.utils import wallet_utils
from python_keywords.payment_neogo import deposit_gas, transfer_gas
from pytest_tests.helpers.cluster import Cluster, NodeBase
from pytest_tests.helpers.payment_neogo import deposit_gas, transfer_gas
from pytest_tests.resources.common import FREE_STORAGE, WALLET_CONFIG, WALLET_PASS
@dataclass @dataclass

View file

@ -22,7 +22,7 @@ GAS_HASH = os.getenv("GAS_HASH", "0xd2a4cff31913016155e38e474a2c06d08be276cf")
FROSTFS_CONTRACT = os.getenv("FROSTFS_IR_CONTRACTS_FROSTFS") FROSTFS_CONTRACT = os.getenv("FROSTFS_IR_CONTRACTS_FROSTFS")
ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir") ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir")
DEVENV_PATH = os.getenv("DEVENV_PATH", os.path.join("..", "frostfs-dev-env")) DEVENV_PATH = os.getenv("DEVENV_PATH", os.path.join("../../pytest_tests", "frostfs-dev-env"))
# Password of wallet owned by user on behalf of whom we are running tests # Password of wallet owned by user on behalf of whom we are running tests
WALLET_PASS = os.getenv("WALLET_PASS", "") WALLET_PASS = os.getenv("WALLET_PASS", "")

View file

@ -1,9 +1,10 @@
import allure import allure
import epoch
import pytest import pytest
from cluster import Cluster
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from pytest_tests.helpers import epoch
from pytest_tests.helpers.cluster import Cluster
# To skip adding every mandatory singleton dependency to EACH test function # To skip adding every mandatory singleton dependency to EACH test function
class ClusterTestBase: class ClusterTestBase:

View file

@ -3,13 +3,14 @@ import re
from dataclasses import asdict from dataclasses import asdict
import allure import allure
from common import STORAGE_NODE_SERVICE_NAME_REGEX
from frostfs_testlib.cli.frostfs_authmate import FrostfsAuthmate from frostfs_testlib.cli.frostfs_authmate import FrostfsAuthmate
from frostfs_testlib.cli.neogo import NeoGo from frostfs_testlib.cli.neogo import NeoGo
from frostfs_testlib.hosting import Hosting from frostfs_testlib.hosting import Hosting
from frostfs_testlib.shell import CommandOptions, SSHShell from frostfs_testlib.shell import CommandOptions, SSHShell
from frostfs_testlib.shell.interfaces import InteractiveInput from frostfs_testlib.shell.interfaces import InteractiveInput
from k6 import K6, LoadParams, LoadResults
from pytest_tests.helpers.k6 import K6, LoadParams, LoadResults
from pytest_tests.resources.common import STORAGE_NODE_SERVICE_NAME_REGEX
FROSTFS_AUTHMATE_PATH = "frostfs-s3-authmate" FROSTFS_AUTHMATE_PATH = "frostfs-s3-authmate"
STOPPED_HOSTS = [] STOPPED_HOSTS = []

View file

@ -11,16 +11,17 @@ import pytest
import s3_gate_bucket import s3_gate_bucket
import s3_gate_object import s3_gate_object
import urllib3 import urllib3
from aws_cli_client import AwsCliClient
from botocore.config import Config from botocore.config import Config
from botocore.exceptions import ClientError from botocore.exceptions import ClientError
from cli_helpers import _cmd_run, _configure_aws_cli, _run_with_passwd
from cluster import Cluster
from cluster_test_base import ClusterTestBase
from common import FROSTFS_AUTHMATE_EXEC
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from pytest import FixtureRequest from pytest import FixtureRequest
from python_keywords.container import list_containers
from pytest_tests.helpers.aws_cli_client import AwsCliClient
from pytest_tests.helpers.cli_helpers import _cmd_run, _configure_aws_cli, _run_with_passwd
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.container import list_containers
from pytest_tests.resources.common import FROSTFS_AUTHMATE_EXEC
from pytest_tests.steps.cluster_test_base import ClusterTestBase
# Disable warnings on self-signed certificate which the # Disable warnings on self-signed certificate which the
# boto library produces on requests to S3-gate in dev-env # boto library produces on requests to S3-gate in dev-env
@ -44,7 +45,7 @@ class TestS3GateBase(ClusterTestBase):
self, default_wallet, client_shell: Shell, request: FixtureRequest, cluster: Cluster self, default_wallet, client_shell: Shell, request: FixtureRequest, cluster: Cluster
) -> Any: ) -> Any:
wallet = default_wallet wallet = default_wallet
s3_bearer_rules_file = f"{os.getcwd()}/robot/resources/files/s3_bearer_rules.json" s3_bearer_rules_file = f"{os.getcwd()}/pytest_tests/resources/files/s3_bearer_rules.json"
policy = None if isinstance(request.param, str) else request.param[1] policy = None if isinstance(request.param, str) else request.param[1]
(cid, bucket, access_key_id, secret_access_key, owner_private_key,) = init_s3_credentials( (cid, bucket, access_key_id, secret_access_key, owner_private_key,) = init_s3_credentials(
wallet, cluster, s3_bearer_rules_file=s3_bearer_rules_file, policy=policy wallet, cluster, s3_bearer_rules_file=s3_bearer_rules_file, policy=policy
@ -123,7 +124,7 @@ def init_s3_credentials(
policy: Optional[dict] = None, policy: Optional[dict] = None,
): ):
bucket = str(uuid.uuid4()) bucket = str(uuid.uuid4())
s3_bearer_rules = s3_bearer_rules_file or "robot/resources/files/s3_bearer_rules.json" s3_bearer_rules = s3_bearer_rules_file or "pytest_tests/resources/files/s3_bearer_rules.json"
s3gate_node = cluster.s3gates[0] s3gate_node = cluster.s3gates[0]
gate_public_key = s3gate_node.get_wallet_public_key() gate_public_key = s3gate_node.get_wallet_public_key()

View file

@ -7,7 +7,8 @@ from typing import Optional
import allure import allure
from botocore.exceptions import ClientError from botocore.exceptions import ClientError
from cli_helpers import log_command_execution
from pytest_tests.helpers.cli_helpers import log_command_execution
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -7,11 +7,12 @@ from typing import Optional
import allure import allure
import pytest import pytest
import urllib3 import urllib3
from aws_cli_client import AwsCliClient
from botocore.exceptions import ClientError from botocore.exceptions import ClientError
from cli_helpers import log_command_execution
from s3_gate_bucket import S3_SYNC_WAIT_TIME from s3_gate_bucket import S3_SYNC_WAIT_TIME
from pytest_tests.helpers.aws_cli_client import AwsCliClient
from pytest_tests.helpers.cli_helpers import log_command_execution
########################################################## ##########################################################
# Disabling warnings on self-signed certificate which the # Disabling warnings on self-signed certificate which the
# boto library produces on requests to S3-gate in dev-env. # boto library produces on requests to S3-gate in dev-env.

View file

@ -8,12 +8,13 @@ from enum import Enum
from typing import Any, Optional from typing import Any, Optional
import allure import allure
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, wallet_utils from frostfs_testlib.utils import json_utils, wallet_utils
from storage_object_info import StorageObjectInfo
from wallet import WalletFile from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from pytest_tests.helpers.wallet import WalletFile
from pytest_tests.resources.common import ASSETS_DIR, FROSTFS_CLI_EXEC, WALLET_CONFIG
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -3,13 +3,14 @@ from time import sleep
import allure import allure
import pytest import pytest
from cluster import Cluster
from epoch import tick_epoch
from frostfs_testlib.resources.common import OBJECT_ALREADY_REMOVED from frostfs_testlib.resources.common import OBJECT_ALREADY_REMOVED
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from python_keywords.frostfs_verbs import delete_object, get_object
from storage_object_info import StorageObjectInfo from pytest_tests.helpers.cluster import Cluster
from tombstone import verify_head_tombstone from pytest_tests.helpers.epoch import tick_epoch
from pytest_tests.helpers.frostfs_verbs import delete_object, get_object
from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from pytest_tests.helpers.tombstone import verify_head_tombstone
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -5,15 +5,16 @@ from typing import Optional
import allure import allure
import pytest import pytest
from cluster import Cluster
from common import WALLET_CONFIG, WALLET_PASS
from file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import wallet_utils from frostfs_testlib.utils import wallet_utils
from python_keywords.acl import EACLRole
from python_keywords.container import create_container from pytest_tests.helpers.acl import EACLRole
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from pytest_tests.resources.common import WALLET_CONFIG, WALLET_PASS
OBJECT_COUNT = 5 OBJECT_COUNT = 5

View file

@ -5,12 +5,10 @@ from typing import Optional
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
from file_helper import generate_file
from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND from frostfs_testlib.resources.common import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND
from frostfs_testlib.utils import wallet_utils from frostfs_testlib.utils import wallet_utils
from python_keywords.acl import (
from pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
EACLRole, EACLRole,
@ -19,10 +17,11 @@ from python_keywords.acl import (
form_bearertoken_file, form_bearertoken_file,
set_eacl, set_eacl,
) )
from python_keywords.container import create_container from pytest_tests.helpers.container import create_container
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.file_helper import generate_file
from python_keywords.payment_neogo import deposit_gas, transfer_gas from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from python_keywords.storage_group import ( from pytest_tests.helpers.payment_neogo import deposit_gas, transfer_gas
from pytest_tests.helpers.storage_group import (
delete_storagegroup, delete_storagegroup,
get_storagegroup, get_storagegroup,
list_storagegroup, list_storagegroup,
@ -30,6 +29,8 @@ from python_keywords.storage_group import (
verify_get_storage_group, verify_get_storage_group,
verify_list_storage_group, verify_list_storage_group,
) )
from pytest_tests.resources.common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
deposit = 30 deposit = 30

View file

@ -1,15 +1,16 @@
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from frostfs_testlib.resources.common import PRIVATE_ACL_F, PUBLIC_ACL_F, READONLY_ACL_F from frostfs_testlib.resources.common import PRIVATE_ACL_F, PUBLIC_ACL_F, READONLY_ACL_F
from python_keywords.acl import EACLRole
from python_keywords.container import create_container from pytest_tests.helpers.acl import EACLRole
from python_keywords.container_access import ( from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.container_access import (
check_full_access_to_container, check_full_access_to_container,
check_no_access_to_container, check_no_access_to_container,
check_read_only_container, check_read_only_container,
) )
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from pytest_tests.steps.cluster_test_base import ClusterTestBase
@pytest.mark.sanity @pytest.mark.sanity

View file

@ -1,7 +1,7 @@
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from python_keywords.acl import ( from pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
EACLRole, EACLRole,
@ -11,11 +11,12 @@ from python_keywords.acl import (
set_eacl, set_eacl,
wait_for_cache_expired, wait_for_cache_expired,
) )
from python_keywords.container_access import ( from pytest_tests.helpers.container_access import (
check_custom_access_to_container, check_custom_access_to_container,
check_full_access_to_container, check_full_access_to_container,
check_no_access_to_container, check_no_access_to_container,
) )
from pytest_tests.steps.cluster_test_base import ClusterTestBase
@pytest.mark.sanity @pytest.mark.sanity

View file

@ -1,9 +1,8 @@
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from failover_utils import wait_object_replication
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from python_keywords.acl import (
from pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
EACLRole, EACLRole,
@ -12,14 +11,15 @@ from python_keywords.acl import (
set_eacl, set_eacl,
wait_for_cache_expired, wait_for_cache_expired,
) )
from python_keywords.container import create_container from pytest_tests.helpers.container import create_container
from python_keywords.container_access import ( from pytest_tests.helpers.container_access import (
check_full_access_to_container, check_full_access_to_container,
check_no_access_to_container, check_no_access_to_container,
) )
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.failover_utils import wait_object_replication
from python_keywords.node_management import drop_object from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from python_keywords.object_access import ( from pytest_tests.helpers.node_management import drop_object
from pytest_tests.helpers.object_access import (
can_delete_object, can_delete_object,
can_get_head_object, can_get_head_object,
can_get_object, can_get_object,
@ -28,6 +28,7 @@ from python_keywords.object_access import (
can_put_object, can_put_object,
can_search_object, can_search_object,
) )
from pytest_tests.steps.cluster_test_base import ClusterTestBase
@pytest.mark.sanity @pytest.mark.sanity

View file

@ -1,8 +1,8 @@
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from python_keywords.acl import (
from pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLFilter, EACLFilter,
EACLFilters, EACLFilters,
@ -16,13 +16,14 @@ from python_keywords.acl import (
set_eacl, set_eacl,
wait_for_cache_expired, wait_for_cache_expired,
) )
from python_keywords.container import create_container, delete_container from pytest_tests.helpers.container import create_container, delete_container
from python_keywords.container_access import ( from pytest_tests.helpers.container_access import (
check_full_access_to_container, check_full_access_to_container,
check_no_access_to_container, check_no_access_to_container,
) )
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.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 pytest_tests.helpers.object_access import can_get_head_object, can_get_object, can_put_object
from pytest_tests.steps.cluster_test_base import ClusterTestBase
@pytest.mark.sanity @pytest.mark.sanity

View file

@ -8,9 +8,19 @@ from datetime import datetime
import allure import allure
import pytest import pytest
import yaml import yaml
from binary_version_helper import get_local_binaries_versions, get_remote_binaries_versions from frostfs_testlib.hosting import Hosting
from cluster import Cluster from frostfs_testlib.reporter import AllureHandler, get_reporter
from common import ( from frostfs_testlib.shell import LocalShell, Shell
from frostfs_testlib.utils import wallet_utils
from pytest_tests.helpers import binary_version, env_properties
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.frostfs_verbs import get_netmap_netinfo
from pytest_tests.helpers.k6 import LoadParams
from pytest_tests.helpers.node_management import storage_node_healthcheck
from pytest_tests.helpers.payment_neogo import deposit_gas, transfer_gas
from pytest_tests.helpers.wallet import WalletFactory
from pytest_tests.resources.common import (
ASSETS_DIR, ASSETS_DIR,
COMPLEX_OBJECT_CHUNKS_COUNT, COMPLEX_OBJECT_CHUNKS_COUNT,
COMPLEX_OBJECT_TAIL_SIZE, COMPLEX_OBJECT_TAIL_SIZE,
@ -20,14 +30,7 @@ from common import (
STORAGE_NODE_SERVICE_NAME_REGEX, STORAGE_NODE_SERVICE_NAME_REGEX,
WALLET_PASS, WALLET_PASS,
) )
from env_properties import save_env_properties from pytest_tests.resources.load_params import (
from frostfs_testlib.hosting import Hosting
from frostfs_testlib.reporter import AllureHandler, get_reporter
from frostfs_testlib.shell import LocalShell, Shell
from frostfs_testlib.utils import wallet_utils
from k6 import LoadParams
from load import get_services_endpoints, prepare_k6_instances
from load_params import (
BACKGROUND_LOAD_MAX_TIME, BACKGROUND_LOAD_MAX_TIME,
BACKGROUND_OBJ_SIZE, BACKGROUND_OBJ_SIZE,
BACKGROUND_READERS_COUNT, BACKGROUND_READERS_COUNT,
@ -36,11 +39,7 @@ from load_params import (
LOAD_NODE_SSH_USER, LOAD_NODE_SSH_USER,
LOAD_NODES, LOAD_NODES,
) )
from payment_neogo import deposit_gas, transfer_gas from pytest_tests.steps.load import get_services_endpoints, prepare_k6_instances
from python_keywords.frostfs_verbs import get_netmap_netinfo
from python_keywords.node_management import storage_node_healthcheck
from helpers.wallet import WalletFactory
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
@ -125,11 +124,11 @@ def cluster(temp_directory: str, hosting: Hosting) -> Cluster:
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
@allure.title("Check binary versions") @allure.title("Check binary versions")
def check_binary_versions(request, hosting: Hosting, client_shell: Shell): def check_binary_versions(request, hosting: Hosting, client_shell: Shell):
local_versions = get_local_binaries_versions(client_shell) local_versions = binary_version.get_local_binaries_versions(client_shell)
remote_versions = get_remote_binaries_versions(hosting) remote_versions = binary_version.get_remote_binaries_versions(hosting)
all_versions = {**local_versions, **remote_versions} all_versions = {**local_versions, **remote_versions}
save_env_properties(request.config, all_versions) env_properties.save_env_properties(request.config, all_versions)
@pytest.fixture(scope="session") @pytest.fixture(scope="session")

View file

@ -3,7 +3,8 @@ import json
import allure import allure
import pytest import pytest
from frostfs_testlib.resources.common import PRIVATE_ACL_F from frostfs_testlib.resources.common import PRIVATE_ACL_F
from python_keywords.container import (
from pytest_tests.helpers.container import (
create_container, create_container,
delete_container, delete_container,
get_container, get_container,
@ -11,9 +12,8 @@ from python_keywords.container import (
wait_for_container_creation, wait_for_container_creation,
wait_for_container_deletion, wait_for_container_deletion,
) )
from utility import placement_policy_from_container from pytest_tests.helpers.utility import placement_policy_from_container
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.cluster_test_base import ClusterTestBase
@pytest.mark.container @pytest.mark.container

View file

@ -4,15 +4,18 @@ from time import sleep
import allure import allure
import pytest import pytest
from cluster import StorageNode
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
from file_helper import generate_file, get_file_hash
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from iptables_helper import IpTablesHelper
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import get_object, put_object_to_random_node
from steps.cluster_test_base import ClusterTestBase from pytest_tests.helpers.cluster import StorageNode
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.failover_utils import (
wait_all_storage_nodes_returned,
wait_object_replication,
)
from pytest_tests.helpers.file_helper import generate_file, get_file_hash
from pytest_tests.helpers.frostfs_verbs import get_object, put_object_to_random_node
from pytest_tests.helpers.iptables_helper import IpTablesHelper
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
STORAGE_NODE_COMMUNICATION_PORT = "8080" STORAGE_NODE_COMMUNICATION_PORT = "8080"

View file

@ -2,16 +2,19 @@ import logging
import allure import allure
import pytest import pytest
from cluster import Cluster, StorageNode
from failover_utils import wait_all_storage_nodes_returned, wait_object_replication
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.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.frostfs_verbs import get_object, put_object_to_random_node
from steps.cluster_test_base import ClusterTestBase from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.failover_utils import (
wait_all_storage_nodes_returned,
wait_object_replication,
)
from pytest_tests.helpers.file_helper import generate_file, get_file_hash
from pytest_tests.helpers.frostfs_verbs import get_object, put_object_to_random_node
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
stopped_nodes: list[StorageNode] = [] stopped_nodes: list[StorageNode] = []

View file

@ -1,23 +1,14 @@
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase from frostfs_testlib.hosting import Hosting
from common import (
from pytest_tests.helpers.k6 import LoadParams
from pytest_tests.resources.common import (
HTTP_GATE_SERVICE_NAME_REGEX, HTTP_GATE_SERVICE_NAME_REGEX,
S3_GATE_SERVICE_NAME_REGEX, S3_GATE_SERVICE_NAME_REGEX,
STORAGE_NODE_SERVICE_NAME_REGEX, STORAGE_NODE_SERVICE_NAME_REGEX,
) )
from frostfs_testlib.hosting import Hosting from pytest_tests.resources.load_params import (
from k6 import LoadParams
from load import (
clear_cache_and_data,
get_services_endpoints,
init_s3_client,
multi_node_k6_run,
prepare_k6_instances,
start_stopped_nodes,
stop_unused_nodes,
)
from load_params import (
CONTAINER_PLACEMENT_POLICY, CONTAINER_PLACEMENT_POLICY,
CONTAINERS_COUNT, CONTAINERS_COUNT,
DELETERS, DELETERS,
@ -34,6 +25,16 @@ from load_params import (
STORAGE_NODE_COUNT, STORAGE_NODE_COUNT,
WRITERS, WRITERS,
) )
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from pytest_tests.steps.load import (
clear_cache_and_data,
get_services_endpoints,
init_s3_client,
multi_node_k6_run,
prepare_k6_instances,
start_stopped_nodes,
stop_unused_nodes,
)
ENDPOINTS_ATTRIBUTES = { ENDPOINTS_ATTRIBUTES = {
"http": {"regex": HTTP_GATE_SERVICE_NAME_REGEX, "endpoint_attribute": "endpoint"}, "http": {"regex": HTTP_GATE_SERVICE_NAME_REGEX, "endpoint_attribute": "endpoint"},

View file

@ -5,16 +5,15 @@ from typing import Optional, Tuple
import allure import allure
import pytest import pytest
from cluster import StorageNode
from cluster_test_base import ClusterTestBase
from common import FROSTFS_CONTRACT_CACHE_TIMEOUT, MORPH_BLOCK_TIME
from epoch import tick_epoch
from file_helper import generate_file
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL
from frostfs_testlib.utils import datetime_utils, string_utils from frostfs_testlib.utils import datetime_utils, string_utils
from python_keywords.container import create_container, get_container
from python_keywords.failover_utils import wait_object_replication from pytest_tests.helpers.cluster import StorageNode
from python_keywords.frostfs_verbs import ( from pytest_tests.helpers.container import create_container, get_container
from pytest_tests.helpers.epoch import tick_epoch
from pytest_tests.helpers.failover_utils import wait_object_replication
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import (
delete_object, delete_object,
get_object, get_object,
get_object_from_random_node, get_object_from_random_node,
@ -22,7 +21,7 @@ from python_keywords.frostfs_verbs import (
put_object, put_object,
put_object_to_random_node, put_object_to_random_node,
) )
from python_keywords.node_management import ( from pytest_tests.helpers.node_management import (
check_node_in_map, check_node_in_map,
delete_node_data, delete_node_data,
drop_object, drop_object,
@ -34,8 +33,13 @@ from python_keywords.node_management import (
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 pytest_tests.helpers.storage_policy import get_nodes_with_object, get_simple_object_copies
from utility import placement_policy_from_container, wait_for_gc_pass_on_storage_nodes from pytest_tests.helpers.utility import (
placement_policy_from_container,
wait_for_gc_pass_on_storage_nodes,
)
from pytest_tests.resources.common import FROSTFS_CONTRACT_CACHE_TIMEOUT, MORPH_BLOCK_TIME
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
check_nodes: list[StorageNode] = [] check_nodes: list[StorageNode] = []
@ -128,7 +132,7 @@ class TestNodeManagement(ClusterTestBase):
simple_object_size, simple_object_size,
): ):
""" """
This test remove one node from cluster then add it back. Test uses base control operations with storage nodes (healthcheck, netmap-snapshot, set-status). This test remove one node from pytest_tests.helpers.cluster then add it back. Test uses base control operations with storage nodes (healthcheck, netmap-snapshot, set-status).
""" """
wallet = default_wallet wallet = default_wallet
placement_rule_3 = "REP 3 IN X CBF 1 SELECT 3 FROM * AS X" placement_rule_3 = "REP 3 IN X CBF 1 SELECT 3 FROM * AS X"

View file

@ -4,9 +4,6 @@ import sys
import allure import allure
import pytest import pytest
from cluster import Cluster
from complex_object_actions import get_complex_object_split_ranges
from file_helper import generate_file, get_file_content, get_file_hash
from frostfs_testlib.resources.common import ( from frostfs_testlib.resources.common import (
INVALID_LENGTH_SPECIFIER, INVALID_LENGTH_SPECIFIER,
INVALID_OFFSET_SPECIFIER, INVALID_OFFSET_SPECIFIER,
@ -16,8 +13,12 @@ from frostfs_testlib.resources.common import (
) )
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from pytest import FixtureRequest from pytest import FixtureRequest
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import ( from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.complex_object_actions import get_complex_object_split_ranges
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.file_helper import generate_file, get_file_content, get_file_hash
from pytest_tests.helpers.frostfs_verbs import (
get_object_from_random_node, get_object_from_random_node,
get_range, get_range,
get_range_hash, get_range_hash,
@ -25,11 +26,10 @@ from python_keywords.frostfs_verbs import (
put_object_to_random_node, put_object_to_random_node,
search_object, search_object,
) )
from python_keywords.storage_policy import get_complex_object_copies, get_simple_object_copies from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from pytest_tests.helpers.storage_policy import get_complex_object_copies, get_simple_object_copies
from helpers.storage_object_info import StorageObjectInfo from pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.cluster_test_base import ClusterTestBase from pytest_tests.steps.storage_object import delete_objects
from steps.storage_object import delete_objects
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,19 +1,30 @@
import allure import allure
import pytest import pytest
from cluster import Cluster
from container import REP_2_FOR_3_NODES_PLACEMENT_RULE, SINGLE_PLACEMENT_RULE, create_container
from epoch import get_epoch
from frostfs_testlib.resources.common import EACL_PUBLIC_READ_WRITE 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 pytest import FixtureRequest from pytest import FixtureRequest
from python_keywords.acl import EACLAccess, EACLOperation, EACLRole, EACLRule, form_bearertoken_file
from helpers.container import StorageContainer, StorageContainerInfo from pytest_tests.helpers.acl import (
from helpers.test_control import expect_not_raises EACLAccess,
from helpers.wallet import WalletFile EACLOperation,
from steps.cluster_test_base import ClusterTestBase EACLRole,
from steps.storage_object import StorageObjectInfo EACLRule,
form_bearertoken_file,
)
from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.container import (
REP_2_FOR_3_NODES_PLACEMENT_RULE,
SINGLE_PLACEMENT_RULE,
StorageContainer,
StorageContainerInfo,
create_container,
)
from pytest_tests.helpers.epoch import get_epoch
from pytest_tests.helpers.frostfs_verbs import delete_object, get_object
from pytest_tests.helpers.test_control import expect_not_raises
from pytest_tests.helpers.wallet import WalletFile
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from pytest_tests.steps.storage_object import StorageObjectInfo
@pytest.fixture(scope="module") @pytest.fixture(scope="module")

View file

@ -2,15 +2,18 @@ import logging
import allure import allure
import pytest import pytest
from epoch import get_epoch
from file_helper import generate_file, get_file_hash
from frostfs_testlib.resources.common 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.frostfs_verbs import get_object_from_random_node, put_object_to_random_node
from utility import wait_for_gc_pass_on_storage_nodes
from steps.cluster_test_base import ClusterTestBase from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.epoch import get_epoch
from pytest_tests.helpers.file_helper import generate_file, get_file_hash
from pytest_tests.helpers.frostfs_verbs import (
get_object_from_random_node,
put_object_to_random_node,
)
from pytest_tests.helpers.utility import wait_for_gc_pass_on_storage_nodes
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -3,11 +3,6 @@ import re
import allure import allure
import pytest import pytest
from cluster import Cluster
from cluster_test_base import ClusterTestBase
from common import STORAGE_GC_TIME
from complex_object_actions import get_link_object, get_storage_object_chunks
from epoch import ensure_fresh_epoch, get_epoch, tick_epoch
from frostfs_testlib.resources.common import ( from frostfs_testlib.resources.common import (
LIFETIME_REQUIRED, LIFETIME_REQUIRED,
LOCK_NON_REGULAR_OBJECT, LOCK_NON_REGULAR_OBJECT,
@ -19,18 +14,22 @@ from frostfs_testlib.resources.common import (
) )
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import datetime_utils from frostfs_testlib.utils import datetime_utils
from node_management import drop_object
from pytest import FixtureRequest from pytest import FixtureRequest
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import delete_object, head_object, lock_object
from storage_policy import get_nodes_with_object
from test_control import expect_not_raises, wait_for_success
from utility import wait_for_gc_pass_on_storage_nodes
from helpers.container import StorageContainer, StorageContainerInfo from pytest_tests.helpers.cluster import Cluster
from helpers.storage_object_info import LockObjectInfo, StorageObjectInfo from pytest_tests.helpers.complex_object_actions import get_link_object, get_storage_object_chunks
from helpers.wallet import WalletFactory, WalletFile from pytest_tests.helpers.container import StorageContainer, StorageContainerInfo, create_container
from steps.storage_object import delete_objects from pytest_tests.helpers.epoch import ensure_fresh_epoch, get_epoch, tick_epoch
from pytest_tests.helpers.frostfs_verbs import delete_object, head_object, lock_object
from pytest_tests.helpers.node_management import drop_object
from pytest_tests.helpers.storage_object_info import LockObjectInfo, StorageObjectInfo
from pytest_tests.helpers.storage_policy import get_nodes_with_object
from pytest_tests.helpers.test_control import expect_not_raises, wait_for_success
from pytest_tests.helpers.utility import wait_for_gc_pass_on_storage_nodes
from pytest_tests.helpers.wallet import WalletFactory, WalletFile
from pytest_tests.resources.common import STORAGE_GC_TIME
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from pytest_tests.steps.storage_object import delete_objects
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -4,11 +4,12 @@ import os
import allure import allure
import pytest import pytest
import yaml import yaml
from cluster_test_base import ClusterTestBase
from common import FREE_STORAGE, FROSTFS_CLI_EXEC, WALLET_CONFIG
from frostfs_testlib.cli import FrostfsCli from frostfs_testlib.cli import FrostfsCli
from frostfs_testlib.shell import CommandResult, Shell from frostfs_testlib.shell import CommandResult, Shell
from wallet import WalletFactory, WalletFile
from pytest_tests.helpers.wallet import WalletFactory, WalletFile
from pytest_tests.resources.common import FREE_STORAGE, FROSTFS_CLI_EXEC, WALLET_CONFIG
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
DEPOSIT_AMOUNT = 30 DEPOSIT_AMOUNT = 30

View file

@ -2,11 +2,9 @@ import logging
import allure import allure
import pytest import pytest
from container import create_container
from file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
from python_keywords.acl import ( from pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
EACLRole, EACLRole,
@ -18,8 +16,10 @@ from python_keywords.acl import (
sign_bearer, sign_bearer,
wait_for_cache_expired, wait_for_cache_expired,
) )
from pytest_tests.helpers.container import create_container
from steps.cluster_test_base import ClusterTestBase from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -3,12 +3,13 @@ import os
import allure import allure
import pytest import pytest
from epoch import get_epoch
from file_helper import generate_file, get_file_hash
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import put_object_to_random_node from pytest_tests.helpers.container import create_container
from python_keywords.http_gate import ( from pytest_tests.helpers.epoch import get_epoch
from pytest_tests.helpers.file_helper import generate_file, get_file_hash
from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from pytest_tests.helpers.http_gate import (
attr_into_header, attr_into_header,
get_object_and_verify_hashes, get_object_and_verify_hashes,
get_object_by_attr_and_verify_hashes, get_object_by_attr_and_verify_hashes,
@ -19,9 +20,8 @@ from python_keywords.http_gate import (
upload_via_http_gate, upload_via_http_gate,
upload_via_http_gate_curl, upload_via_http_gate_curl,
) )
from utility import wait_for_gc_pass_on_storage_nodes from pytest_tests.helpers.utility import wait_for_gc_pass_on_storage_nodes
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
OBJECT_NOT_FOUND_ERROR = "not found" OBJECT_NOT_FOUND_ERROR = "not found"

View file

@ -3,26 +3,26 @@ import os
import allure import allure
import pytest import pytest
from container import ( from frostfs_testlib.resources.common import PUBLIC_ACL
from pytest import FixtureRequest
from pytest_tests.helpers.container import (
create_container, create_container,
delete_container, delete_container,
list_containers, list_containers,
wait_for_container_deletion, wait_for_container_deletion,
) )
from file_helper import generate_file from pytest_tests.helpers.file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL from pytest_tests.helpers.frostfs_verbs import delete_object
from http_gate import ( from pytest_tests.helpers.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,
try_to_get_object_and_expect_error, try_to_get_object_and_expect_error,
try_to_get_object_via_passed_request_and_expect_error, try_to_get_object_via_passed_request_and_expect_error,
upload_via_http_gate_curl, upload_via_http_gate_curl,
) )
from pytest import FixtureRequest from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from python_keywords.frostfs_verbs import delete_object from pytest_tests.steps.cluster_test_base import ClusterTestBase
from helpers.storage_object_info import StorageObjectInfo
from steps.cluster_test_base import ClusterTestBase
OBJECT_ALREADY_REMOVED_ERROR = "object already removed" OBJECT_ALREADY_REMOVED_ERROR = "object already removed"
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -2,17 +2,17 @@ import logging
import allure import allure
import pytest import pytest
from container import create_container
from file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from http_gate import (
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import put_object_to_random_node
from pytest_tests.helpers.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 pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -2,12 +2,12 @@ import logging
import allure import allure
import pytest import pytest
from container import create_container
from file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL from frostfs_testlib.resources.common import PUBLIC_ACL
from http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
from steps.cluster_test_base import ClusterTestBase from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.http_gate import get_object_and_verify_hashes, upload_via_http_gate_curl
from pytest_tests.steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -5,23 +5,23 @@ from typing import Optional
import allure import allure
import pytest import pytest
from container import create_container
from epoch import get_epoch, wait_for_epochs_align
from file_helper import generate_file
from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL from frostfs_testlib.resources.common import OBJECT_NOT_FOUND, PUBLIC_ACL
from http_gate import (
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.epoch import get_epoch, wait_for_epochs_align
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import (
get_netmap_netinfo,
get_object_from_random_node,
head_object,
)
from pytest_tests.helpers.http_gate import (
attr_into_str_header_curl, attr_into_str_header_curl,
get_object_and_verify_hashes, get_object_and_verify_hashes,
try_to_get_object_and_expect_error, try_to_get_object_and_expect_error,
upload_via_http_gate_curl, upload_via_http_gate_curl,
) )
from python_keywords.frostfs_verbs import ( from pytest_tests.steps.cluster_test_base import ClusterTestBase
get_netmap_netinfo,
get_object_from_random_node,
head_object,
)
from steps.cluster_test_base import ClusterTestBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
EXPIRATION_TIMESTAMP_HEADER = "__FROSRFS__EXPIRATION_TIMESTAMP" EXPIRATION_TIMESTAMP_HEADER = "__FROSRFS__EXPIRATION_TIMESTAMP"

View file

@ -1,10 +1,10 @@
import allure import allure
import pytest import pytest
from file_helper import generate_file
from s3_helper import assert_s3_acl, object_key_from_file_path
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.file_helper import generate_file
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.s3_helper import assert_s3_acl, object_key_from_file_path
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -2,16 +2,16 @@ from datetime import datetime, timedelta
import allure import allure
import pytest import pytest
from file_helper import generate_file
from s3_helper import ( from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.s3_helper import (
assert_object_lock_mode, assert_object_lock_mode,
assert_s3_acl, assert_s3_acl,
check_objects_in_bucket, check_objects_in_bucket,
object_key_from_file_path, object_key_from_file_path,
) )
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.steps.s3_gate_base import TestS3GateBase
from steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -4,26 +4,26 @@ from random import choice, choices
import allure import allure
import pytest import pytest
from aws_cli_client import AwsCliClient
from common import ASSETS_DIR from pytest_tests.helpers.aws_cli_client import AwsCliClient
from epoch import tick_epoch from pytest_tests.helpers.epoch import tick_epoch
from file_helper import ( from pytest_tests.helpers.file_helper import (
generate_file, generate_file,
generate_file_with_content, generate_file_with_content,
get_file_content, get_file_content,
get_file_hash, get_file_hash,
split_file, split_file,
) )
from s3_helper import ( from pytest_tests.helpers.s3_helper import (
check_objects_in_bucket, check_objects_in_bucket,
check_tags_by_bucket, check_tags_by_bucket,
check_tags_by_object, check_tags_by_object,
set_bucket_versioning, set_bucket_versioning,
try_to_get_objects_and_expect_error, try_to_get_objects_and_expect_error,
) )
from pytest_tests.resources.common import ASSETS_DIR
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from steps.s3_gate_base import TestS3GateBase from pytest_tests.steps.s3_gate_base import TestS3GateBase
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -3,11 +3,15 @@ from datetime import datetime, timedelta
import allure import allure
import pytest import pytest
from file_helper import generate_file, generate_file_with_content
from s3_helper import assert_object_lock_mode, check_objects_in_bucket, object_key_from_file_path
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.file_helper import generate_file, generate_file_with_content
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.s3_helper import (
assert_object_lock_mode,
check_objects_in_bucket,
object_key_from_file_path,
)
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -1,10 +1,14 @@
import allure import allure
import pytest import pytest
from file_helper import generate_file, get_file_hash, split_file
from s3_helper import check_objects_in_bucket, object_key_from_file_path, set_bucket_versioning
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.file_helper import generate_file, get_file_hash, split_file
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.s3_helper import (
check_objects_in_bucket,
object_key_from_file_path,
set_bucket_versioning,
)
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
PART_SIZE = 5 * 1024 * 1024 PART_SIZE = 5 * 1024 * 1024

View file

@ -6,20 +6,25 @@ from random import choices, sample
import allure import allure
import pytest import pytest
from aws_cli_client import AwsCliClient
from common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
from file_helper import concat_files, generate_file, generate_file_with_content, get_file_hash
from frostfs_testlib.utils import wallet_utils from frostfs_testlib.utils import wallet_utils
from python_keywords.payment_neogo import deposit_gas, transfer_gas
from s3_helper import ( from pytest_tests.helpers.aws_cli_client import AwsCliClient
from pytest_tests.helpers.file_helper import (
concat_files,
generate_file,
generate_file_with_content,
get_file_hash,
)
from pytest_tests.helpers.payment_neogo import deposit_gas, transfer_gas
from pytest_tests.helpers.s3_helper import (
assert_object_lock_mode, assert_object_lock_mode,
assert_s3_acl, assert_s3_acl,
check_objects_in_bucket, check_objects_in_bucket,
set_bucket_versioning, set_bucket_versioning,
) )
from pytest_tests.resources.common import ASSETS_DIR, FREE_STORAGE, WALLET_PASS
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from steps.s3_gate_base import TestS3GateBase from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -2,17 +2,21 @@ import os
import allure import allure
import pytest import pytest
from file_helper import generate_file
from python_keywords.container import search_container_by_name
from python_keywords.storage_policy import get_simple_object_copies
from s3_helper import check_objects_in_bucket, object_key_from_file_path, set_bucket_versioning
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.container import search_container_by_name
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.s3_helper import (
check_objects_in_bucket,
object_key_from_file_path,
set_bucket_versioning,
)
from pytest_tests.helpers.storage_policy import get_simple_object_copies
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):
policy = f"{os.getcwd()}/robot/resources/files/policy.json" policy = f"{os.getcwd()}/pytest_tests/resources/files/policy.json"
if "s3_client" in metafunc.fixturenames: if "s3_client" in metafunc.fixturenames:
metafunc.parametrize( metafunc.parametrize(
"s3_client", "s3_client",
@ -95,7 +99,7 @@ class TestS3GatePolicy(TestS3GateBase):
s3_gate_bucket.get_bucket_policy(self.s3_client, bucket) s3_gate_bucket.get_bucket_policy(self.s3_client, bucket)
with allure.step("Put new policy"): with allure.step("Put new policy"):
custom_policy = f"file://{os.getcwd()}/robot/resources/files/bucket_policy.json" custom_policy = f"file://{os.getcwd()}/pytest_tests/resources/files/bucket_policy.json"
custom_policy = { custom_policy = {
"Version": "2008-10-17", "Version": "2008-10-17",
"Id": "aaaa-bbbb-cccc-dddd", "Id": "aaaa-bbbb-cccc-dddd",

View file

@ -1,16 +1,18 @@
import os
import uuid
from random import choice from random import choice
from string import ascii_letters from string import ascii_letters
from typing import Tuple from typing import Tuple
import allure import allure
import pytest import pytest
from file_helper import generate_file
from s3_helper import check_tags_by_bucket, check_tags_by_object, object_key_from_file_path
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.file_helper import generate_file
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.s3_helper import (
check_tags_by_bucket,
check_tags_by_object,
object_key_from_file_path,
)
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -2,11 +2,11 @@ import os
import allure import allure
import pytest import pytest
from file_helper import generate_file, generate_file_with_content
from s3_helper import set_bucket_versioning
from steps import s3_gate_bucket, s3_gate_object from pytest_tests.helpers.file_helper import generate_file, generate_file_with_content
from steps.s3_gate_base import TestS3GateBase from pytest_tests.helpers.s3_helper import set_bucket_versioning
from pytest_tests.steps import s3_gate_bucket, s3_gate_object
from pytest_tests.steps.s3_gate_base import TestS3GateBase
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):

View file

@ -5,11 +5,12 @@ from re import match
import allure import allure
import pytest import pytest
import requests import requests
from binary_version_helper import get_remote_binaries_versions
from common import BIN_VERSIONS_FILE
from env_properties import read_env_properties, save_env_properties
from frostfs_testlib.hosting import Hosting from frostfs_testlib.hosting import Hosting
from pytest_tests.helpers.binary_version import get_remote_binaries_versions
from pytest_tests.helpers.env_properties import read_env_properties, save_env_properties
from pytest_tests.resources.common import BIN_VERSIONS_FILE
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,5 +1,6 @@
import pytest import pytest
from wallet import WalletFactory, WalletFile
from pytest_tests.helpers.wallet import WalletFactory, WalletFile
@pytest.fixture(scope="module") @pytest.fixture(scope="module")

View file

@ -2,15 +2,15 @@ import random
import allure import allure
import pytest import pytest
from cluster_test_base import ClusterTestBase
from common import WALLET_PASS
from file_helper import generate_file
from frostfs_testlib.resources.common import SESSION_NOT_FOUND from frostfs_testlib.resources.common import SESSION_NOT_FOUND
from frostfs_testlib.utils import wallet_utils from frostfs_testlib.utils import wallet_utils
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import delete_object, put_object, put_object_to_random_node
from steps.session_token import create_session_token from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import delete_object, put_object, put_object_to_random_node
from pytest_tests.resources.common import WALLET_PASS
from pytest_tests.steps.cluster_test_base import ClusterTestBase
from pytest_tests.steps.session_token import create_session_token
@pytest.mark.sanity @pytest.mark.sanity

View file

@ -2,10 +2,6 @@ import logging
import allure import allure
import pytest import pytest
from cluster import Cluster
from cluster_test_base import ClusterTestBase
from epoch import ensure_fresh_epoch
from file_helper import generate_file
from frostfs_testlib.resources.common import ( from frostfs_testlib.resources.common import (
EXPIRED_SESSION_TOKEN, EXPIRED_SESSION_TOKEN,
MALFORMED_REQUEST, MALFORMED_REQUEST,
@ -14,8 +10,12 @@ from frostfs_testlib.resources.common import (
) )
from frostfs_testlib.shell import Shell from frostfs_testlib.shell import Shell
from pytest import FixtureRequest from pytest import FixtureRequest
from python_keywords.container import create_container
from python_keywords.frostfs_verbs import ( from pytest_tests.helpers.cluster import Cluster
from pytest_tests.helpers.container import create_container
from pytest_tests.helpers.epoch import ensure_fresh_epoch
from pytest_tests.helpers.file_helper import generate_file
from pytest_tests.helpers.frostfs_verbs import (
delete_object, delete_object,
get_object, get_object,
get_object_from_random_node, get_object_from_random_node,
@ -25,11 +25,11 @@ from python_keywords.frostfs_verbs import (
put_object_to_random_node, put_object_to_random_node,
search_object, search_object,
) )
from test_control import expect_not_raises from pytest_tests.helpers.storage_object_info import StorageObjectInfo
from wallet import WalletFile from pytest_tests.helpers.test_control import expect_not_raises
from pytest_tests.helpers.wallet import WalletFile
from helpers.storage_object_info import StorageObjectInfo from pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.session_token import ( from pytest_tests.steps.session_token import (
INVALID_SIGNATURE, INVALID_SIGNATURE,
UNRELATED_CONTAINER, UNRELATED_CONTAINER,
UNRELATED_KEY, UNRELATED_KEY,
@ -41,7 +41,7 @@ from steps.session_token import (
get_object_signed_token, get_object_signed_token,
sign_session_token, sign_session_token,
) )
from steps.storage_object import delete_objects from pytest_tests.steps.storage_object import delete_objects
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")

View file

@ -1,9 +1,9 @@
import allure import allure
import pytest import pytest
from file_helper import generate_file
from frostfs_testlib.resources.common import PUBLIC_ACL 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 pytest_tests.helpers.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
EACLRole, EACLRole,
@ -12,17 +12,17 @@ from python_keywords.acl import (
set_eacl, set_eacl,
wait_for_cache_expired, wait_for_cache_expired,
) )
from python_keywords.container import ( from pytest_tests.helpers.container import (
create_container, create_container,
delete_container, delete_container,
get_container, get_container,
list_containers, list_containers,
) )
from python_keywords.object_access import can_put_object from pytest_tests.helpers.file_helper import generate_file
from wallet import WalletFile from pytest_tests.helpers.object_access import can_put_object
from pytest_tests.helpers.wallet import WalletFile
from steps.cluster_test_base import ClusterTestBase from pytest_tests.steps.cluster_test_base import ClusterTestBase
from steps.session_token import ContainerVerb, get_container_signed_token from pytest_tests.steps.session_token import ContainerVerb, get_container_signed_token
@pytest.mark.static_session_container @pytest.mark.static_session_container

View file

@ -7,11 +7,12 @@ from io import StringIO
import allure import allure
import pytest import pytest
import yaml import yaml
from cluster import Cluster, StorageNode
from common import WALLET_CONFIG
from configobj import ConfigObj from configobj import ConfigObj
from frostfs_testlib.cli import FrostfsCli from frostfs_testlib.cli import FrostfsCli
from pytest_tests.helpers.cluster import Cluster, StorageNode
from pytest_tests.resources.common import WALLET_CONFIG
SHARD_PREFIX = "FROSTFS_STORAGE_SHARD_" SHARD_PREFIX = "FROSTFS_STORAGE_SHARD_"
BLOBSTOR_PREFIX = "_BLOBSTOR_" BLOBSTOR_PREFIX = "_BLOBSTOR_"

View file

@ -1 +0,0 @@
password: ""

View file

@ -50,7 +50,6 @@ pytest-lazy-fixture==0.6.3
python-dateutil==2.8.2 python-dateutil==2.8.2
pyyaml==6.0 pyyaml==6.0
requests==2.28.0 requests==2.28.0
robotframework==4.1.2
s3transfer==0.3.7 s3transfer==0.3.7
six==1.16.0 six==1.16.0
tenacity==8.0.1 tenacity==8.0.1

View file

@ -1,239 +0,0 @@
#!/usr/bin/python3.9
"""
This module contains keywords that utilize `frostfs-cli container` commands.
"""
import json
import logging
from time import sleep
from typing import Optional, Union
import allure
from common import FROSTFS_CLI_EXEC, WALLET_CONFIG
from frostfs_testlib.cli import FrostfsCli
from frostfs_testlib.shell import Shell
from frostfs_testlib.utils import json_utils
logger = logging.getLogger("NeoLogger")
DEFAULT_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X"
SINGLE_PLACEMENT_RULE = "REP 1 IN X CBF 1 SELECT 4 FROM * AS X"
REP_2_FOR_3_NODES_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 3 FROM * AS X"
@allure.step("Create Container")
def create_container(
wallet: str,
shell: Shell,
endpoint: str,
rule: str = DEFAULT_PLACEMENT_RULE,
basic_acl: str = "",
attributes: Optional[dict] = None,
session_token: str = "",
session_wallet: str = "",
name: str = None,
options: dict = None,
await_mode: bool = True,
wait_for_creation: bool = True,
) -> str:
"""
A wrapper for `frostfs-cli container create` call.
Args:
wallet (str): a wallet on whose behalf a container is created
rule (optional, str): placement rule for container
basic_acl (optional, str): an ACL for container, will be
appended to `--basic-acl` key
attributes (optional, dict): container attributes , will be
appended to `--attributes` key
session_token (optional, str): a path to session token file
session_wallet(optional, str): a path to the wallet which signed
the session token; this parameter makes sense
when paired with `session_token`
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
options (optional, dict): any other options to pass to the call
name (optional, str): container name attribute
await_mode (bool): block execution until container is persisted
wait_for_creation (): Wait for container shows in container list
Returns:
(str): CID of the created container
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.create(
rpc_endpoint=endpoint,
wallet=session_wallet if session_wallet else wallet,
policy=rule,
basic_acl=basic_acl,
attributes=attributes,
name=name,
session=session_token,
await_mode=await_mode,
**options or {},
)
cid = _parse_cid(result.stdout)
logger.info("Container created; waiting until it is persisted in the sidechain")
if wait_for_creation:
wait_for_container_creation(wallet, cid, shell, endpoint)
return cid
def wait_for_container_creation(
wallet: str, cid: str, shell: Shell, endpoint: str, attempts: int = 15, sleep_interval: int = 1
):
for _ in range(attempts):
containers = list_containers(wallet, shell, endpoint)
if cid in containers:
return
logger.info(f"There is no {cid} in {containers} yet; sleep {sleep_interval} and continue")
sleep(sleep_interval)
raise RuntimeError(
f"After {attempts * sleep_interval} seconds container {cid} hasn't been persisted; exiting"
)
def wait_for_container_deletion(
wallet: str, cid: str, shell: Shell, endpoint: str, attempts: int = 30, sleep_interval: int = 1
):
for _ in range(attempts):
try:
get_container(wallet, cid, shell=shell, endpoint=endpoint)
sleep(sleep_interval)
continue
except Exception as err:
if "container not found" not in str(err):
raise AssertionError(f'Expected "container not found" in error, got\n{err}')
return
raise AssertionError(f"Expected container deleted during {attempts * sleep_interval} sec.")
@allure.step("List Containers")
def list_containers(wallet: str, shell: Shell, endpoint: str) -> list[str]:
"""
A wrapper for `frostfs-cli container list` call. It returns all the
available containers for the given wallet.
Args:
wallet (str): a wallet on whose behalf we list the containers
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
Returns:
(list): list of containers
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.list(rpc_endpoint=endpoint, wallet=wallet)
logger.info(f"Containers: \n{result}")
return result.stdout.split()
@allure.step("Get Container")
def get_container(
wallet: str,
cid: str,
shell: Shell,
endpoint: str,
json_mode: bool = True,
) -> Union[dict, str]:
"""
A wrapper for `frostfs-cli container get` call. It extracts container's
attributes and rearranges them into a more compact view.
Args:
wallet (str): path to a wallet on whose behalf we get the container
cid (str): ID of the container to get
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
json_mode (bool): return container in JSON format
Returns:
(dict, str): dict of container attributes
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
result = cli.container.get(rpc_endpoint=endpoint, wallet=wallet, cid=cid, json_mode=json_mode)
if not json_mode:
return result.stdout
container_info = json.loads(result.stdout)
attributes = dict()
for attr in container_info["attributes"]:
attributes[attr["key"]] = attr["value"]
container_info["attributes"] = attributes
container_info["ownerID"] = json_utils.json_reencode(container_info["ownerID"]["value"])
return container_info
@allure.step("Delete Container")
# TODO: make the error message about a non-found container more user-friendly
# https://github.com/nspcc-dev/frostfs-contract/issues/121
def delete_container(
wallet: str,
cid: str,
shell: Shell,
endpoint: str,
force: bool = False,
session_token: Optional[str] = None,
await_mode: bool = False,
) -> None:
"""
A wrapper for `frostfs-cli container delete` call.
Args:
wallet (str): path to a wallet on whose behalf we delete the container
cid (str): ID of the container to delete
shell: executor for cli command
endpoint: FrostFS endpoint to send request to, appends to `--rpc-endpoint` key
force (bool): do not check whether container contains locks and remove immediately
session_token: a path to session token file
This function doesn't return anything.
"""
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, WALLET_CONFIG)
cli.container.delete(
wallet=wallet,
cid=cid,
rpc_endpoint=endpoint,
force=force,
session=session_token,
await_mode=await_mode,
)
def _parse_cid(output: str) -> str:
"""
Parses container ID from a given CLI output. The input string we expect:
container ID: 2tz86kVTDpJxWHrhw3h6PbKMwkLtBEwoqhHQCKTre1FN
awaiting...
container has been persisted on sidechain
We want to take 'container ID' value from the string.
Args:
output (str): CLI output to parse
Returns:
(str): extracted CID
"""
try:
# taking first line from command's output
first_line = output.split("\n")[0]
except Exception:
first_line = ""
logger.error(f"Got empty output: {output}")
splitted = first_line.split(": ")
if len(splitted) != 2:
raise ValueError(f"no CID was parsed from command output: \t{first_line}")
return splitted[1]
@allure.step("Search container by name")
def search_container_by_name(wallet: str, name: str, shell: Shell, endpoint: str):
list_cids = list_containers(wallet, shell, endpoint)
for cid in list_cids:
cont_info = get_container(wallet, cid, shell, endpoint, True)
if cont_info.get("attributes").get("Name", None) == name:
return cid
return None

View file

@ -1,23 +0,0 @@
EACL_OBJ_FILTERS = {
"$Object:objectID": "objectID",
"$Object:containerID": "containerID",
"$Object:ownerID": "ownerID",
"$Object:creationEpoch": "creationEpoch",
"$Object:payloadLength": "payloadLength",
"$Object:payloadHash": "payloadHash",
"$Object:objectType": "objectType",
"$Object:homomorphicHash": "homomorphicHash",
"$Object:version": "version",
}
VERB_FILTER_DEP = {
"$Object:objectID": ["GET", "HEAD", "DELETE", "RANGE", "RANGEHASH"],
"$Object:containerID": ["GET", "PUT", "HEAD", "DELETE", "SEARCH", "RANGE", "RANGEHASH"],
"$Object:ownerID": ["GET", "HEAD"],
"$Object:creationEpoch": ["GET", "PUT", "HEAD"],
"$Object:payloadLength": ["GET", "PUT", "HEAD"],
"$Object:payloadHash": ["GET", "PUT", "HEAD"],
"$Object:objectType": ["GET", "PUT", "HEAD"],
"$Object:homomorphicHash": ["GET", "PUT", "HEAD"],
"$Object:version": ["GET", "PUT", "HEAD"],
}

View file

@ -3,6 +3,4 @@ export NEOFS_MORPH_DISABLE_CACHE=true
export DEVENV_PATH="${DEVENV_PATH:-${VIRTUAL_ENV}/../../frostfs-dev-env}" export DEVENV_PATH="${DEVENV_PATH:-${VIRTUAL_ENV}/../../frostfs-dev-env}"
pushd $DEVENV_PATH > /dev/null pushd $DEVENV_PATH > /dev/null
export `make env` export `make env`
popd > /dev/null popd > /dev/null
export PYTHONPATH=${PYTHONPATH}:${VIRTUAL_ENV}/../robot/resources/lib/:${VIRTUAL_ENV}/../robot/resources/lib/python_keywords:${VIRTUAL_ENV}/../robot/resources/lib/robot:${VIRTUAL_ENV}/../robot/variables:${VIRTUAL_ENV}/../pytest_tests/helpers:${VIRTUAL_ENV}/../pytest_tests/steps:${VIRTUAL_ENV}/../pytest_tests/resources