forked from TrueCloudLab/frostfs-testcases
Switch storagegroup and session_token tests to testlib library
Signed-off-by: Vladimir Avdeev <v.avdeev@yadro.com>
This commit is contained in:
parent
c9e42a7a0a
commit
bf71f3250d
10 changed files with 301 additions and 190 deletions
|
@ -10,7 +10,6 @@ from typing import Any, Dict, List, Optional, Union
|
|||
|
||||
import allure
|
||||
import base58
|
||||
from cli_helpers import _cmd_run
|
||||
from common import ASSETS_DIR, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, WALLET_CONFIG
|
||||
from data_formatters import get_wallet_public_key
|
||||
from neofs_testlib.cli import NeofsCli
|
||||
|
@ -120,14 +119,14 @@ class EACLRule:
|
|||
def get_eacl(wallet_path: str, cid: str, shell: Shell) -> Optional[str]:
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
||||
try:
|
||||
output = cli.container.get_eacl(wallet=wallet_path, rpc_endpoint=NEOFS_ENDPOINT, cid=cid)
|
||||
result = cli.container.get_eacl(wallet=wallet_path, rpc_endpoint=NEOFS_ENDPOINT, cid=cid)
|
||||
except RuntimeError as exc:
|
||||
logger.info("Extended ACL table is not set for this container")
|
||||
logger.info(f"Got exception while getting eacl: {exc}")
|
||||
return None
|
||||
if "extended ACL table is not set for this container" in output.stdout:
|
||||
if "extended ACL table is not set for this container" in result.stdout:
|
||||
return None
|
||||
return output.stdout
|
||||
return result.stdout
|
||||
|
||||
|
||||
@allure.title("Set extended ACL")
|
||||
|
@ -208,7 +207,7 @@ def form_bearertoken_file(
|
|||
json.dump(eacl_result, eacl_file, ensure_ascii=False, indent=4)
|
||||
|
||||
logger.info(f"Got these extended ACL records: {eacl_result}")
|
||||
sign_bearer(wif, file_path)
|
||||
sign_bearer(shell, wif, file_path)
|
||||
return file_path
|
||||
|
||||
|
||||
|
@ -235,12 +234,11 @@ def eacl_rules(access: str, verbs: list, user: str) -> list[str]:
|
|||
return rules
|
||||
|
||||
|
||||
def sign_bearer(wallet_path: str, eacl_rules_file: str) -> None:
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} util sign bearer-token --from {eacl_rules_file} "
|
||||
f"--to {eacl_rules_file} --wallet {wallet_path} --config {WALLET_CONFIG} --json"
|
||||
def sign_bearer(shell: Shell, wallet_path: str, eacl_rules_file: str) -> None:
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=WALLET_CONFIG)
|
||||
neofscli.util.sign_bearer_token(
|
||||
wallet=wallet_path, from_file=eacl_rules_file, to_file=eacl_rules_file, json=True
|
||||
)
|
||||
_cmd_run(cmd)
|
||||
|
||||
|
||||
@allure.title("Wait for eACL cache expired")
|
||||
|
|
|
@ -59,7 +59,7 @@ def create_container(
|
|||
"""
|
||||
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
||||
output = cli.container.create(
|
||||
result = cli.container.create(
|
||||
rpc_endpoint=NEOFS_ENDPOINT,
|
||||
wallet=session_wallet if session_wallet else wallet,
|
||||
policy=rule,
|
||||
|
@ -71,7 +71,7 @@ def create_container(
|
|||
**options or {},
|
||||
)
|
||||
|
||||
cid = _parse_cid(output.stdout)
|
||||
cid = _parse_cid(result.stdout)
|
||||
|
||||
logger.info("Container created; waiting until it is persisted in the sidechain")
|
||||
|
||||
|
@ -122,9 +122,9 @@ def list_containers(wallet: str, shell: Shell) -> list[str]:
|
|||
(list): list of containers
|
||||
"""
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
||||
output = cli.container.list(rpc_endpoint=NEOFS_ENDPOINT, wallet=wallet)
|
||||
result = cli.container.list(rpc_endpoint=NEOFS_ENDPOINT, wallet=wallet)
|
||||
logger.info(f"Containers: \n{output}")
|
||||
return output.stdout.split()
|
||||
return result.stdout.split()
|
||||
|
||||
|
||||
@allure.step("Get Container")
|
||||
|
@ -146,14 +146,14 @@ def get_container(
|
|||
(dict, str): dict of container attributes
|
||||
"""
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
||||
output = cli.container.get(
|
||||
result = cli.container.get(
|
||||
rpc_endpoint=NEOFS_ENDPOINT, wallet=wallet, cid=cid, json_mode=json_mode
|
||||
)
|
||||
|
||||
if not json_mode:
|
||||
return output.stdout
|
||||
return result.stdout
|
||||
|
||||
container_info = json.loads(output.stdout)
|
||||
container_info = json.loads(result.stdout)
|
||||
attributes = dict()
|
||||
for attr in container_info["attributes"]:
|
||||
attributes[attr["key"]] = attr["value"]
|
||||
|
|
|
@ -102,7 +102,7 @@ def get_range_hash(
|
|||
"""
|
||||
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, wallet_config or WALLET_CONFIG)
|
||||
output = cli.object.hash(
|
||||
result = cli.object.hash(
|
||||
rpc_endpoint=endpoint or NEOFS_ENDPOINT,
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
|
@ -113,7 +113,7 @@ def get_range_hash(
|
|||
)
|
||||
|
||||
# cutting off output about range offset and length
|
||||
return output.stdout.split(":")[1].strip()
|
||||
return result.stdout.split(":")[1].strip()
|
||||
|
||||
|
||||
@allure.step("Put object")
|
||||
|
@ -156,7 +156,7 @@ def put_object(
|
|||
logger.info(f"---DEB:\n{NEOFS_NETMAP}")
|
||||
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, wallet_config or WALLET_CONFIG)
|
||||
output = cli.object.put(
|
||||
result = cli.object.put(
|
||||
rpc_endpoint=endpoint,
|
||||
wallet=wallet,
|
||||
file=path,
|
||||
|
@ -170,7 +170,7 @@ def put_object(
|
|||
)
|
||||
|
||||
# splitting CLI output to lines and taking the penultimate line
|
||||
id_str = output.stdout.strip().split("\n")[-2]
|
||||
id_str = result.stdout.strip().split("\n")[-2]
|
||||
oid = id_str.split(":")[1]
|
||||
return oid.strip()
|
||||
|
||||
|
@ -204,7 +204,7 @@ def delete_object(
|
|||
(str): Tombstone ID
|
||||
"""
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, wallet_config or WALLET_CONFIG)
|
||||
output = cli.object.delete(
|
||||
result = cli.object.delete(
|
||||
rpc_endpoint=endpoint or NEOFS_ENDPOINT,
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
|
@ -214,7 +214,7 @@ def delete_object(
|
|||
session=session,
|
||||
)
|
||||
|
||||
id_str = output.stdout.split("\n")[1]
|
||||
id_str = result.stdout.split("\n")[1]
|
||||
tombstone = id_str.split(":")[1]
|
||||
return tombstone.strip()
|
||||
|
||||
|
@ -301,7 +301,7 @@ def search_object(
|
|||
"""
|
||||
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, wallet_config or WALLET_CONFIG)
|
||||
output = cli.object.search(
|
||||
result = cli.object.search(
|
||||
rpc_endpoint=endpoint or NEOFS_ENDPOINT,
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
|
@ -313,7 +313,7 @@ def search_object(
|
|||
session=session,
|
||||
)
|
||||
|
||||
found_objects = re.findall(r"(\w{43,44})", output.stdout)
|
||||
found_objects = re.findall(r"(\w{43,44})", result.stdout)
|
||||
|
||||
if expected_objects_list:
|
||||
if sorted(found_objects) == sorted(expected_objects_list):
|
||||
|
@ -372,7 +372,7 @@ def head_object(
|
|||
"""
|
||||
|
||||
cli = NeofsCli(shell, NEOFS_CLI_EXEC, wallet_config or WALLET_CONFIG)
|
||||
output = cli.object.head(
|
||||
result = cli.object.head(
|
||||
rpc_endpoint=endpoint or NEOFS_ENDPOINT,
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
|
@ -386,18 +386,18 @@ def head_object(
|
|||
)
|
||||
|
||||
if not json_output:
|
||||
return output
|
||||
return result
|
||||
|
||||
try:
|
||||
decoded = json.loads(output.stdout)
|
||||
decoded = json.loads(result.stdout)
|
||||
except Exception as exc:
|
||||
# If we failed to parse output as JSON, the cause might be
|
||||
# the plain text string in the beginning of the output.
|
||||
# Here we cut off first string and try to parse again.
|
||||
logger.info(f"failed to parse output: {exc}")
|
||||
logger.info("parsing output in another way")
|
||||
fst_line_idx = output.stdout.find("\n")
|
||||
decoded = json.loads(output.stdout[fst_line_idx:])
|
||||
fst_line_idx = result.stdout.find("\n")
|
||||
decoded = json.loads(result.stdout[fst_line_idx:])
|
||||
|
||||
# If response is Complex Object header, it has `splitId` key
|
||||
if "splitId" in decoded.keys():
|
||||
|
|
|
@ -139,16 +139,14 @@ def transfer_gas(
|
|||
the assets will be transferred to the last one.
|
||||
Args:
|
||||
shell: Shell instance.
|
||||
wallet_from_password: password of the wallet; it is
|
||||
required to decode the wallet and extract its addresses
|
||||
wallet_from_path: path to chain node wallet
|
||||
address_from: the address of the wallet to transfer assets from
|
||||
wallet_to_path: the path to the wallet to transfer assets to
|
||||
wallet_to_password: the password to the wallet to transfer assets to
|
||||
address_to: the address of the wallet to transfer assets to
|
||||
amount: amount of gas to transfer
|
||||
Returns:
|
||||
(void)
|
||||
wallet_from_password: Password of the wallet; it is required to decode the wallet
|
||||
and extract its addresses.
|
||||
wallet_from_path: Path to chain node wallet.
|
||||
address_from: The address of the wallet to transfer assets from.
|
||||
wallet_to_path: The path to the wallet to transfer assets to.
|
||||
wallet_to_password: The password to the wallet to transfer assets to.
|
||||
address_to: The address of the wallet to transfer assets to.
|
||||
amount: Amount of gas to transfer.
|
||||
"""
|
||||
address_to = address_to or get_last_address_from_wallet(wallet_to_path, wallet_to_password)
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@ import uuid
|
|||
|
||||
import allure
|
||||
import json_transformers
|
||||
from cli_helpers import _cmd_run, _run_with_passwd
|
||||
from common import ASSETS_DIR, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, WALLET_CONFIG
|
||||
from neofs_testlib.cli import NeofsCli
|
||||
from neofs_testlib.shell import Shell
|
||||
from neo3 import wallet
|
||||
|
||||
logger = logging.getLogger("NeoLogger")
|
||||
|
@ -70,39 +71,52 @@ def generate_session_token(owner: str, session_wallet: str, cid: str = "") -> st
|
|||
|
||||
|
||||
@allure.step("Create Session Token")
|
||||
def create_session_token(owner: str, wallet_path: str, rpc: str = NEOFS_ENDPOINT):
|
||||
def create_session_token(
|
||||
shell: Shell,
|
||||
owner: str,
|
||||
wallet_path: str,
|
||||
wallet_password: str,
|
||||
rpc_endpoint: str = NEOFS_ENDPOINT,
|
||||
) -> str:
|
||||
"""
|
||||
Create session token for an object.
|
||||
Args:
|
||||
owner(str): user that writes the token
|
||||
session_wallet(str): the path to wallet to which we grant the
|
||||
access via session token
|
||||
shell: Shell instance.
|
||||
owner: User that writes the token.
|
||||
wallet_path: The path to wallet to which we grant the access via session token.
|
||||
wallet_password: Wallet password.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
Returns:
|
||||
(str): the path to the generated session token file
|
||||
The path to the generated session token file.
|
||||
"""
|
||||
session_token = os.path.join(os.getcwd(), ASSETS_DIR, str(uuid.uuid4()))
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} session create --address {owner} -w {wallet_path} "
|
||||
f"--out {session_token} --rpc-endpoint {rpc}"
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC)
|
||||
neofscli.session.create(
|
||||
rpc_endpoint=rpc_endpoint,
|
||||
address=owner,
|
||||
wallet=wallet_path,
|
||||
wallet_password=wallet_password,
|
||||
out=session_token,
|
||||
)
|
||||
_run_with_passwd(cmd)
|
||||
return session_token
|
||||
|
||||
|
||||
@allure.step("Sign Session Token")
|
||||
def sign_session_token(session_token: str, wlt: str):
|
||||
def sign_session_token(shell: Shell, session_token_file: str, wlt: str) -> str:
|
||||
"""
|
||||
This function signs the session token by the given wallet.
|
||||
|
||||
Args:
|
||||
session_token(str): the path to the session token file
|
||||
wlt(str): the path to the signing wallet
|
||||
shell: Shell instance.
|
||||
session_token_file: The path to the session token file.
|
||||
wlt: The path to the signing wallet.
|
||||
|
||||
Returns:
|
||||
(str): the path to the signed token
|
||||
The path to the signed token.
|
||||
"""
|
||||
signed_token = os.path.join(os.getcwd(), ASSETS_DIR, str(uuid.uuid4()))
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} util sign session-token --from {session_token} "
|
||||
f"-w {wlt} --to {signed_token} --config {WALLET_CONFIG}"
|
||||
signed_token_file = os.path.join(os.getcwd(), ASSETS_DIR, str(uuid.uuid4()))
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=WALLET_CONFIG)
|
||||
neofscli.util.sign_session_token(
|
||||
wallet=wlt, from_file=session_token_file, to_file=signed_token_file
|
||||
)
|
||||
_cmd_run(cmd)
|
||||
return signed_token
|
||||
return signed_token_file
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
It contains wrappers for `neofs-cli storagegroup` verbs.
|
||||
"""
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
import allure
|
||||
from cli_helpers import _cmd_run
|
||||
from common import COMPLEX_OBJ_SIZE, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, SIMPLE_OBJ_SIZE, WALLET_CONFIG
|
||||
from complex_object_actions import get_link_object
|
||||
from neofs_testlib.cli import NeofsCli
|
||||
from neofs_testlib.shell import Shell
|
||||
from neofs_verbs import head_object
|
||||
|
||||
|
@ -16,95 +17,108 @@ logger = logging.getLogger("NeoLogger")
|
|||
|
||||
@allure.step("Put Storagegroup")
|
||||
def put_storagegroup(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
objects: list,
|
||||
bearer: str = "",
|
||||
bearer: Optional[str] = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
lifetime: str = "10",
|
||||
):
|
||||
lifetime: int = 10,
|
||||
) -> str:
|
||||
"""
|
||||
Wrapper for `neofs-cli storagegroup put`. Before the SG is created,
|
||||
neofs-cli performs HEAD on `objects`, so this verb must be allowed
|
||||
for `wallet` in `cid`.
|
||||
Args:
|
||||
wallet (str): path to wallet on whose behalf the SG is created
|
||||
cid (str): ID of Container to put SG to
|
||||
objects (list): list of Object IDs to include into the SG
|
||||
bearer (optional, str): path to Bearer token file
|
||||
wallet_config (optional, str): path to neofs-cli config file
|
||||
shell: Shell instance.
|
||||
wallet: Path to wallet on whose behalf the SG is created.
|
||||
cid: ID of Container to put SG to.
|
||||
lifetime: Storage group lifetime in epochs.
|
||||
objects: List of Object IDs to include into the SG.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to neofs-cli config file.
|
||||
Returns:
|
||||
(str): Object ID of created Storage Group
|
||||
Object ID of created Storage Group.
|
||||
"""
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
|
||||
f"--wallet {wallet} --config {wallet_config} "
|
||||
f"storagegroup put --cid {cid} --lifetime {lifetime} "
|
||||
f'--members {",".join(objects)} '
|
||||
f'{"--bearer " + bearer if bearer else ""}'
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=wallet_config)
|
||||
result = neofscli.storagegroup.put(
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
lifetime=lifetime,
|
||||
members=objects,
|
||||
bearer=bearer,
|
||||
rpc_endpoint=NEOFS_ENDPOINT,
|
||||
)
|
||||
output = _cmd_run(cmd)
|
||||
oid = output.split("\n")[1].split(": ")[1]
|
||||
return oid
|
||||
gid = result.stdout.split("\n")[1].split(": ")[1]
|
||||
return gid
|
||||
|
||||
|
||||
@allure.step("List Storagegroup")
|
||||
def list_storagegroup(wallet: str, cid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG):
|
||||
def list_storagegroup(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
bearer: Optional[str] = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
) -> list:
|
||||
"""
|
||||
Wrapper for `neofs-cli storagegroup list`. This operation
|
||||
requires SEARCH allowed for `wallet` in `cid`.
|
||||
Args:
|
||||
wallet (str): path to wallet on whose behalf the SGs are
|
||||
listed in the container
|
||||
cid (str): ID of Container to list
|
||||
bearer (optional, str): path to Bearer token file
|
||||
wallet_config (optional, str): path to neofs-cli config file
|
||||
shell: Shell instance.
|
||||
wallet: Path to wallet on whose behalf the SGs are listed in the container
|
||||
cid: ID of Container to list.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to neofs-cli config file.
|
||||
Returns:
|
||||
(list): Object IDs of found Storage Groups
|
||||
Object IDs of found Storage Groups.
|
||||
"""
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
|
||||
f"--wallet {wallet} --config {wallet_config} storagegroup list "
|
||||
f'--cid {cid} {"--bearer " + bearer if bearer else ""}'
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=wallet_config)
|
||||
result = neofscli.storagegroup.list(
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
bearer=bearer,
|
||||
rpc_endpoint=NEOFS_ENDPOINT,
|
||||
)
|
||||
output = _cmd_run(cmd)
|
||||
# throwing off the first string of output
|
||||
found_objects = output.split("\n")[1:]
|
||||
found_objects = result.stdout.split("\n")[1:]
|
||||
return found_objects
|
||||
|
||||
|
||||
@allure.step("Get Storagegroup")
|
||||
def get_storagegroup(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
oid: str,
|
||||
gid: str,
|
||||
bearer: str = "",
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
):
|
||||
) -> dict:
|
||||
"""
|
||||
Wrapper for `neofs-cli storagegroup get`.
|
||||
Args:
|
||||
wallet (str): path to wallet on whose behalf the SG is got
|
||||
cid (str): ID of Container where SG is stored
|
||||
oid (str): ID of the Storage Group
|
||||
bearer (optional, str): path to Bearer token file
|
||||
wallet_config (optional, str): path to neofs-cli config file
|
||||
shell: Shell instance.
|
||||
wallet: Path to wallet on whose behalf the SG is got.
|
||||
cid: ID of Container where SG is stored.
|
||||
gid: ID of the Storage Group.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to neofs-cli config file.
|
||||
Returns:
|
||||
(dict): detailed information on the Storage Group
|
||||
Detailed information on the Storage Group.
|
||||
"""
|
||||
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
|
||||
f"--wallet {wallet} --config {wallet_config} "
|
||||
f"storagegroup get --cid {cid} --id {oid} "
|
||||
f'{"--bearer " + bearer if bearer else ""}'
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=wallet_config)
|
||||
result = neofscli.storagegroup.get(
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
bearer=bearer,
|
||||
id=gid,
|
||||
rpc_endpoint=NEOFS_ENDPOINT,
|
||||
)
|
||||
output = _cmd_run(cmd)
|
||||
|
||||
# TODO: temporary solution for parsing output. Needs to be replaced with
|
||||
# JSON parsing when https://github.com/nspcc-dev/neofs-node/issues/1355
|
||||
# is done.
|
||||
strings = output.strip().split("\n")
|
||||
strings = result.stdout.strip().split("\n")
|
||||
# first three strings go to `data`;
|
||||
# skip the 'Members:' string;
|
||||
# the rest of strings go to `members`
|
||||
|
@ -121,55 +135,60 @@ def get_storagegroup(
|
|||
|
||||
@allure.step("Delete Storagegroup")
|
||||
def delete_storagegroup(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
oid: str,
|
||||
gid: str,
|
||||
bearer: str = "",
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
):
|
||||
) -> str:
|
||||
"""
|
||||
Wrapper for `neofs-cli storagegroup delete`.
|
||||
Args:
|
||||
wallet (str): path to wallet on whose behalf the SG is deleted
|
||||
cid (str): ID of Container where SG is stored
|
||||
oid (str): ID of the Storage Group
|
||||
bearer (optional, str): path to Bearer token file
|
||||
wallet_config (optional, str): path to neofs-cli config file
|
||||
shell: Shell instance.
|
||||
wallet: Path to wallet on whose behalf the SG is deleted.
|
||||
cid: ID of Container where SG is stored.
|
||||
gid: ID of the Storage Group.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to neofs-cli config file.
|
||||
Returns:
|
||||
(str): Tombstone ID of the deleted Storage Group
|
||||
Tombstone ID of the deleted Storage Group.
|
||||
"""
|
||||
|
||||
cmd = (
|
||||
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
|
||||
f"--wallet {wallet} --config {wallet_config} "
|
||||
f"storagegroup delete --cid {cid} --id {oid} "
|
||||
f'{"--bearer " + bearer if bearer else ""}'
|
||||
neofscli = NeofsCli(shell=shell, neofs_cli_exec_path=NEOFS_CLI_EXEC, config_file=wallet_config)
|
||||
result = neofscli.storagegroup.delete(
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
bearer=bearer,
|
||||
id=gid,
|
||||
rpc_endpoint=NEOFS_ENDPOINT,
|
||||
)
|
||||
output = _cmd_run(cmd)
|
||||
tombstone_id = output.strip().split("\n")[1].split(": ")[1]
|
||||
tombstone_id = result.stdout.strip().split("\n")[1].split(": ")[1]
|
||||
return tombstone_id
|
||||
|
||||
|
||||
@allure.step("Verify list operation over Storagegroup")
|
||||
def verify_list_storage_group(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
storagegroup: str,
|
||||
gid: str,
|
||||
bearer: str = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
):
|
||||
storage_groups = list_storagegroup(wallet, cid, bearer=bearer, wallet_config=wallet_config)
|
||||
assert storagegroup in storage_groups
|
||||
storage_groups = list_storagegroup(
|
||||
shell=shell, wallet=wallet, cid=cid, bearer=bearer, wallet_config=wallet_config
|
||||
)
|
||||
assert gid in storage_groups
|
||||
|
||||
|
||||
@allure.step("Verify get operation over Storagegroup")
|
||||
def verify_get_storage_group(
|
||||
shell: Shell,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
storagegroup: str,
|
||||
gid: str,
|
||||
obj_list: list,
|
||||
object_size: int,
|
||||
shell: Shell,
|
||||
bearer: str = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
):
|
||||
|
@ -192,7 +211,12 @@ def verify_get_storage_group(
|
|||
|
||||
obj_num = len(obj_list)
|
||||
storagegroup_data = get_storagegroup(
|
||||
wallet, cid, storagegroup, bearer=bearer, wallet_config=wallet_config
|
||||
shell=shell,
|
||||
wallet=wallet,
|
||||
cid=cid,
|
||||
gid=gid,
|
||||
bearer=bearer,
|
||||
wallet_config=wallet_config,
|
||||
)
|
||||
if object_size == SIMPLE_OBJ_SIZE:
|
||||
exp_size = SIMPLE_OBJ_SIZE * obj_num
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue