From 3e749abcd0a5dc72c8cb87cd68a8362b2b73da09 Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Mon, 25 Apr 2022 12:53:20 +0300 Subject: [PATCH] added keywords library `container.py` extracted from `neofs.py` Signed-off-by: anastasia prasolova --- robot/resources/lib/python/container.py | 158 ++++++++++++++++++ robot/resources/lib/python/data_formatters.py | 21 +++ robot/resources/lib/python/neofs.py | 127 +------------- robot/resources/lib/python/neofs_verbs.py | 19 +-- .../lib/robot/common_steps_acl_basic.robot | 19 +-- .../lib/robot/common_steps_acl_bearer.robot | 10 +- .../lib/robot/common_steps_acl_extended.robot | 25 ++- .../lib/robot/common_steps_object.robot | 10 +- .../acl/acl_extended_deny_replication.robot | 18 +- .../container/container_attributes.robot | 54 +++--- .../container/container_delete.robot | 41 ++--- .../container/container_session_token.robot | 18 +- .../network/netmap_control_drop.robot | 12 +- .../integration/network/netmap_simple.robot | 41 +++-- .../integration/network/replication.robot | 12 +- .../object/object_attributes.robot | 18 +- .../integration/services/http_gate.robot | 8 +- .../integration/services/s3_gate_object.robot | 9 +- 18 files changed, 317 insertions(+), 303 deletions(-) create mode 100644 robot/resources/lib/python/container.py create mode 100644 robot/resources/lib/python/data_formatters.py diff --git a/robot/resources/lib/python/container.py b/robot/resources/lib/python/container.py new file mode 100644 index 0000000..0b1db7b --- /dev/null +++ b/robot/resources/lib/python/container.py @@ -0,0 +1,158 @@ +#!/usr/bin/python3 + +""" + This module contains keywords which utilize `neofs-cli container` + commands. +""" + +import json +import time + +from common import NEOFS_ENDPOINT, COMMON_PLACEMENT_RULE, NEOFS_CLI_EXEC, WALLET_PASS +from cli_helpers import _cmd_run +from data_formatters import dict_to_attrs + +from robot.api.deco import keyword +from robot.api import logger + + +ROBOT_AUTO_KEYWORDS = False + + +@keyword('Create Container') +def create_container(wallet: str, rule: str=COMMON_PLACEMENT_RULE, basic_acl: str='', + attributes: dict={}, session_token: str='', session_wallet: str='', + options: str=''): + """ + A wrapper for `neofs-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` + options (optional, str): any other options to pass to the call + + Returns: + (str): CID of the created container + """ + + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} container create ' + f'--wallet {session_wallet if session_wallet else wallet} ' + f'--config {WALLET_PASS} --policy "{rule}" ' + f'{"--basic-acl " + basic_acl if basic_acl else ""} ' + f'{"--attributes " + dict_to_attrs(attributes) if attributes else ""} ' + f'{"--session " + session_token if session_token else ""} ' + f'{options} --await' + ) + output = _cmd_run(cmd, timeout=60) + cid = _parse_cid(output) + + logger.info("Container created; waiting until it is persisted in sidechain") + + deadline_to_persist = 15 # seconds + for i in range(0, deadline_to_persist): + time.sleep(1) + containers = list_containers(wallet) + if cid in containers: + break + logger.info(f"There is no {cid} in {containers} yet; continue") + if i+1 == deadline_to_persist: + raise RuntimeError( + f"After {deadline_to_persist} seconds the container " + f"{cid} hasn't been persisted; exiting" + ) + return cid + + +@keyword('List Containers') +def list_containers(wallet: str): + """ + A wrapper for `neofs-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 + Returns: + (list): list of containers + """ + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' + f'--config {WALLET_PASS} container list' + ) + output = _cmd_run(cmd) + return output.split() + + +@keyword('Get Container Attributes') +def get_container_attributes(wallet: str, cid: str): + """ + A wrapper for `neofs-cli container get` call. It extracts + container attributes and rearranges them to more compact view. + Args: + wallet (str): a wallet on whose behalf we get the container + cid (str): ID of the container to get + Returns: + (dict): dict of container attributes + """ + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' + f'--config {WALLET_PASS} --cid {cid} container get --json' + ) + output = _cmd_run(cmd) + container_info = json.loads(output) + attributes = dict() + for attr in container_info['attributes']: + attributes[attr['key']] = attr['value'] + return attributes + + +@keyword('Delete Container') +# TODO: make the error message about a non-found container more user-friendly +# https://github.com/nspcc-dev/neofs-contract/issues/121 +def delete_container(wallet: str, cid: str): + """ + A wrapper for `neofs-cli container delete` call. + Args: + wallet (str): a wallet on whose behalf we delete the container + cid (str): ID of the container to delete + This function doesn't return anything. + """ + + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' + f'--config {WALLET_PASS} container delete --cid {cid}' + ) + _cmd_run(cmd) + + +def _parse_cid(ouptut: str): + """ + This function parses CID from 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: + ouptut (str): a command run output + + Returns: + (str): extracted CID + """ + try: + # taking first string from command output + fst_str = ouptut.split('\n')[0] + except Exception: + logger.error(f"Got empty output: {ouptut}") + splitted = fst_str.split(": ") + if len(splitted) != 2: + raise ValueError(f"no CID was parsed from command output: \t{fst_str}") + return splitted[1] diff --git a/robot/resources/lib/python/data_formatters.py b/robot/resources/lib/python/data_formatters.py new file mode 100644 index 0000000..437ca37 --- /dev/null +++ b/robot/resources/lib/python/data_formatters.py @@ -0,0 +1,21 @@ +""" + A bunch of functions which might rearrange some data or + change their representation. +""" + +from functools import reduce + + +def dict_to_attrs(attrs: dict): + ''' + This function takes dictionary of object attributes and converts them + into the string. The string is passed to `--attibutes` key of the + neofs-cli. + + Args: + attrs (dict): object attirbutes in {"a": "b", "c": "d"} format. + + Returns: + (str): string in "a=b,c=d" format. + ''' + return reduce(lambda a,b: f"{a},{b}", map(lambda i: f"{i}={attrs[i]}", attrs)) diff --git a/robot/resources/lib/python/neofs.py b/robot/resources/lib/python/neofs.py index d99b395..5f4e2d1 100644 --- a/robot/resources/lib/python/neofs.py +++ b/robot/resources/lib/python/neofs.py @@ -17,7 +17,6 @@ from robot.api.deco import keyword from robot.api import logger from cli_helpers import _run_with_passwd, _cmd_run -import neofs_verbs import json_transformers ROBOT_AUTO_KEYWORDS = False @@ -123,53 +122,6 @@ def validate_storage_policy_for_object(wallet: str, expected_copies: int, cid, o raise Exception(f"Found node list '{found_nodes}' is not equal to expected list '{expected_node_list}'") -@keyword('Create container') -def create_container(wallet: str, basic_acl:str, rule:str, user_headers: str='', session: str=''): - if rule == "": - logger.error("Cannot create container with empty placement rule") - - if basic_acl: - basic_acl = f"--basic-acl {basic_acl}" - if user_headers: - user_headers = f"--attributes {user_headers}" - if session: - session = f"--session {session}" - - createContainerCmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'container create --policy "{rule}" {basic_acl} {user_headers} {session} --config {WALLET_PASS} --await' - ) - output = _cmd_run(createContainerCmd) - cid = _parse_cid(output) - logger.info(f"Created container {cid} with rule {rule}") - - return cid - -@keyword('Container List') -def container_list(wallet: str): - Cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'container list --config {WALLET_PASS}' - ) - output = _cmd_run(Cmd) - - container_list = re.findall(r'(\w{43,44})', output) - logger.info(f"Containers list: {container_list}") - return container_list - - -@keyword('Container Existing') -def container_existing(wallet: str, cid: str): - Cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'container list --config {WALLET_PASS}' - ) - output = _cmd_run(Cmd) - - _find_cid(output, cid) - return - - @keyword('Verify Head Tombstone') def verify_head_tombstone(wallet: str, cid: str, oid_ts: str, oid: str, addr: str): # TODO: replace with HEAD from neofs_verbs.py @@ -219,50 +171,6 @@ def verify_head_tombstone(wallet: str, cid: str, oid_ts: str, oid: str, addr: st raise Exception("Header Session OID (deleted object) is not expected.") -@keyword('Get container attributes') -def get_container_attributes(wallet: str, cid: str, endpoint: str="", json_output: bool = False): - - if endpoint == "": - endpoint = NEOFS_ENDPOINT - - container_cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {endpoint} --wallet {wallet} --config {WALLET_PASS} ' - f'--cid {cid} container get {"--json" if json_output else ""}' - ) - output = _cmd_run(container_cmd) - return output - - -@keyword('Decode Container Attributes Json') -def decode_container_attributes_json(header): - result_header = dict() - json_header = json.loads(header) - - attributes = [] - attribute_list = json_header["attributes"] - if attribute_list is not None: - for e in attribute_list: - values_list = list(e.values()) - attribute = values_list[0] + '=' + values_list[1] - attributes.append(attribute) - result_header["Attributes"] = attributes - else: - raise Exception(f"no Attributes were parsed from header: \t{header}") - - return result_header - - -@keyword('Delete Container') -# TODO: make the error message about a non-found container more user-friendly https://github.com/nspcc-dev/neofs-contract/issues/121 -def delete_container(cid: str, wallet: str): - - deleteContainerCmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'container delete --cid {cid} --config {WALLET_PASS}' - ) - _cmd_run(deleteContainerCmd) - - @keyword('Get file hash') def get_file_hash(filename : str): file_hash = _get_file_hash(filename) @@ -286,6 +194,7 @@ def get_control_endpoint_with_wif(endpoint_number: str = ''): return endpoint_num, endpoint_control, wif + @keyword('Get Locode') def get_locode(): endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values())) @@ -438,6 +347,7 @@ def delete_storagegroup(wallet: str, cid: str, oid: str, bearer_token: str=""): raise Exception(f"no Tombstone ID was parsed from command output: \t{output}") return oid + @keyword('Generate Session Token') def generate_session_token(owner: str, pub_key: str, cid: str = "", wildcard: bool = False) -> str: @@ -497,17 +407,6 @@ def _get_file_hash(filename): logger.info(f"Hash: {hash.hexdigest()}") return hash.hexdigest() -def _find_cid(output: str, cid: str): - """ - This function parses CID from given CLI output. - Parameters: - - output: a string with command run output - """ - if re.search(fr'({cid})', output): - logger.info(f"CID {cid} was parsed from command output: \t{output}") - else: - raise Exception(f"no CID {cid} was parsed from command output: \t{output}") - return cid def _parse_oid(input_str: str): """ @@ -531,28 +430,6 @@ def _parse_oid(input_str: str): raise Exception(f"no OID was parsed from command output: \t{snd_str}") return splitted[1] -def _parse_cid(input_str: str): - """ - This function parses CID from 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. - - Parameters: - - input_str: a string with command run output - """ - try: - # taking first string from command output - fst_str = input_str.split('\n')[0] - except: - logger.error(f"Got empty output: {input_str}") - splitted = fst_str.split(": ") - if len(splitted) != 2: - raise Exception(f"no CID was parsed from command output: \t{fst_str}") - return splitted[1] - def _search_object(node:str, wallet: str, cid:str, oid: str): Cmd = ( diff --git a/robot/resources/lib/python/neofs_verbs.py b/robot/resources/lib/python/neofs_verbs.py index 9352192..9275da5 100644 --- a/robot/resources/lib/python/neofs_verbs.py +++ b/robot/resources/lib/python/neofs_verbs.py @@ -9,11 +9,11 @@ import os import re import random import uuid -from functools import reduce from common import NEOFS_ENDPOINT, ASSETS_DIR, NEOFS_NETMAP, WALLET_PASS from cli_helpers import _cmd_run import json_transformers +from data_formatters import dict_to_attrs from robot.api.deco import keyword from robot.api import logger @@ -108,7 +108,7 @@ def put_object(wallet: str, path: str, cid: str, bearer: str="", user_headers: d f'{NEOFS_CLI_EXEC} --rpc-endpoint {endpoint} --wallet {wallet} ' f'object put --file {path} --cid {cid} {options} --config {WALLET_PASS} ' f'{"--bearer " + bearer if bearer else ""} ' - f'{"--attributes " + _dict_to_attrs(user_headers) if user_headers else ""}' + f'{"--attributes " + dict_to_attrs(user_headers) if user_headers else ""}' ) output = _cmd_run(cmd) # splitting CLI output to lines and taking the penultimate line @@ -282,18 +282,3 @@ def head_object(wallet: str, cid: str, oid: str, bearer_token: str="", logger.info("decoding simple header") return json_transformers.decode_simple_header(decoded) - - -def _dict_to_attrs(attrs: dict): - ''' - This function takes dictionary of object attributes and converts them - into the string. The string is passed to `--attibutes` key of the - neofs-cli. - - Args: - attrs (dict): object attirbutes in {"a": "b", "c": "d"} format. - - Returns: - (str): string in "a=b,c=d" format. - ''' - return reduce(lambda a,b: f"{a},{b}", map(lambda i: f"{i}={attrs[i]}", attrs)) diff --git a/robot/resources/lib/robot/common_steps_acl_basic.robot b/robot/resources/lib/robot/common_steps_acl_basic.robot index 9a48ee4..47cbab3 100644 --- a/robot/resources/lib/robot/common_steps_acl_basic.robot +++ b/robot/resources/lib/robot/common_steps_acl_basic.robot @@ -2,30 +2,23 @@ Variables common.py Variables wellknown_acl.py +Library container.py + *** Keywords *** Create Private Container [Arguments] ${USER_KEY} - Log Create Private Container - ${PRIV_CID_GEN} = Create container ${USER_KEY} ${PRIVATE_ACL_F} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${PRIV_CID_GEN} + ${PRIV_CID_GEN} = Create container ${USER_KEY} basic_acl=${PRIVATE_ACL_F} [Return] ${PRIV_CID_GEN} Create Public Container [Arguments] ${USER_KEY} - Log Create Public Container - ${PUBLIC_CID_GEN} = Create container ${USER_KEY} ${PUBLIC_ACL_F} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${PUBLIC_CID_GEN} - [Return] ${PUBLIC_CID_GEN} + ${PUBLIC_CID_GEN} = Create container ${USER_KEY} basic_acl=${PUBLIC_ACL_F} + [Return] ${PUBLIC_CID_GEN} Create Read-Only Container [Arguments] ${USER_KEY} - Log Create Read-Only Container - ${READONLY_CID_GEN} = Create container ${USER_KEY} ${READONLY_ACL_F} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${READONLY_CID_GEN} + ${READONLY_CID_GEN} = Create container ${USER_KEY} basic_acl=${READONLY_ACL_F} [Return] ${READONLY_CID_GEN} diff --git a/robot/resources/lib/robot/common_steps_acl_bearer.robot b/robot/resources/lib/robot/common_steps_acl_bearer.robot index 482f233..7fbe589 100644 --- a/robot/resources/lib/robot/common_steps_acl_bearer.robot +++ b/robot/resources/lib/robot/common_steps_acl_bearer.robot @@ -2,20 +2,18 @@ Variables common.py Variables wellknown_acl.py +Library container.py + *** Keywords *** Create Container Public [Arguments] ${USER_KEY} - ${PUBLIC_CID_GEN} = Create container ${USER_KEY} ${PUBLIC_ACL} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${PUBLIC_CID_GEN} + ${PUBLIC_CID_GEN} = Create container ${USER_KEY} basic_acl=${PUBLIC_ACL} [Return] ${PUBLIC_CID_GEN} Create Container Inaccessible [Arguments] ${USER_KEY} - ${INACCESSIBLE_CID_GEN} = Create container ${USER_KEY} ${INACCESSIBLE_ACL} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${INACCESSIBLE_CID_GEN} + ${INACCESSIBLE_CID_GEN} = Create container ${USER_KEY} basic_acl=${INACCESSIBLE_ACL} [Return] ${INACCESSIBLE_CID_GEN} diff --git a/robot/resources/lib/robot/common_steps_acl_extended.robot b/robot/resources/lib/robot/common_steps_acl_extended.robot index 880b496..55df154 100644 --- a/robot/resources/lib/robot/common_steps_acl_extended.robot +++ b/robot/resources/lib/robot/common_steps_acl_extended.robot @@ -3,28 +3,27 @@ Variables common.py Variables eacl_object_filters.py Library acl.py +Library container.py Library neofs.py Library neofs_verbs.py + Library Collections Resource common_steps_acl_basic.robot Resource payment_operations.robot *** Variables *** -&{USER_HEADER} = key1=1 key2=abc +&{USER_HEADER} = key1=1 key2=abc &{USER_HEADER_DEL} = key1=del key2=del &{ANOTHER_HEADER} = key1=oth key2=oth -${OBJECT_PATH} = testfile -${EACL_ERR_MSG} = * +${OBJECT_PATH} = testfile +${EACL_ERR_MSG} = * *** Keywords *** Create Container Public [Arguments] ${WALLET} - Log Create Public Container - ${PUBLIC_CID_GEN} = Create container ${WALLET} ${PUBLIC_ACL} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${PUBLIC_CID_GEN} + ${PUBLIC_CID_GEN} = Create container ${WALLET} basic_acl=${PUBLIC_ACL} [Return] ${PUBLIC_CID_GEN} Generate files @@ -34,7 +33,7 @@ Generate files ${FILE_S_GEN_2} = Generate file of bytes ${SIZE} Set Global Variable ${FILE_S} ${FILE_S_GEN_1} Set Global Variable ${FILE_S_2} ${FILE_S_GEN_2} - + Check eACL Deny and Allow All [Arguments] ${WALLET} ${DENY_EACL} ${ALLOW_EACL} ${USER_WALLET} @@ -122,11 +121,11 @@ Object Header Decoded Check eACL Filters with MatchType String Equal [Arguments] ${FILTER} - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} - ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} + ${CID} = Create Container Public ${WALLET} + ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} @@ -146,8 +145,8 @@ Check eACL Filters with MatchType String Equal # The current ACL cache lifetime is 30 sec Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} - IF 'GET' in ${VERB_FILTER_DEP}[${FILTER}] - Run Keyword And Expect Error ${EACL_ERR_MSG} + IF 'GET' in ${VERB_FILTER_DEP}[${FILTER}] + Run Keyword And Expect Error ${EACL_ERR_MSG} ... Get object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH} END IF 'HEAD' in ${VERB_FILTER_DEP}[${FILTER}] diff --git a/robot/resources/lib/robot/common_steps_object.robot b/robot/resources/lib/robot/common_steps_object.robot index 47a7628..e88801f 100644 --- a/robot/resources/lib/robot/common_steps_object.robot +++ b/robot/resources/lib/robot/common_steps_object.robot @@ -1,22 +1,16 @@ *** Settings *** Variables common.py +Library container.py Library wallet_keywords.py Library rpc_call_keywords.py -*** Variables *** -${PLACEMENT_RULE} = REP 2 IN X CBF 1 SELECT 2 FROM * AS X -${CONTAINER_WAIT_INTERVAL} = 1 min - *** Keywords *** Prepare container [Arguments] ${WIF} ${WALLET} ${NEOFS_BALANCE} = Get NeoFS Balance ${WIF} - - ${CID} = Create container ${WALLET} ${EMPTY} ${PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} + ${CID} = Create container ${WALLET} ${NEW_NEOFS_BALANCE} = Get NeoFS Balance ${WIF} Should Be True ${NEW_NEOFS_BALANCE} < ${NEOFS_BALANCE} diff --git a/robot/testsuites/integration/acl/acl_extended_deny_replication.robot b/robot/testsuites/integration/acl/acl_extended_deny_replication.robot index 4502cd0..5c805b2 100644 --- a/robot/testsuites/integration/acl/acl_extended_deny_replication.robot +++ b/robot/testsuites/integration/acl/acl_extended_deny_replication.robot @@ -1,15 +1,16 @@ *** Settings *** Variables common.py -Library Collections +Library container.py Library neofs.py Library neofs_verbs.py Library acl.py Library payment_neogo.py - Library contract_keywords.py Library wallet_keywords.py +Library Collections + Resource eacl_tables.robot Resource common_steps_acl_bearer.robot Resource payment_operations.robot @@ -25,7 +26,7 @@ ${DEPOSIT} = ${30} *** Test cases *** eACL Deny Replication Operations [Documentation] Testcase to validate NeoFS replication with eACL deny rules. - [Tags] ACL NeoFS_CLI Replication + [Tags] ACL Replication [Timeout] 20 min [Setup] Setup @@ -35,16 +36,11 @@ eACL Deny Replication Operations ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - Log Check Replication with eACL deny - object should be replicated # https://github.com/nspcc-dev/neofs-node/issues/881 - ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} - - ${CID} = Create container ${WALLET} ${PUBLIC_ACL} ${FULL_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} - - Prepare eACL Role rules ${CID} + ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} + ${CID} = Create container ${WALLET} basic_acl=${PUBLIC_ACL} rule=${FULL_PLACEMENT_RULE} + Prepare eACL Role rules ${CID} ${OID} = Put object ${WALLET} ${FILE} ${CID} diff --git a/robot/testsuites/integration/container/container_attributes.robot b/robot/testsuites/integration/container/container_attributes.robot index 445d25f..3556b49 100644 --- a/robot/testsuites/integration/container/container_attributes.robot +++ b/robot/testsuites/integration/container/container_attributes.robot @@ -1,28 +1,27 @@ *** Settings *** Variables common.py -Library neofs.py -Library payment_neogo.py -Library String -Library Collections +Library container.py +Library neofs.py +Library payment_neogo.py +Library String +Library Collections Resource setup_teardown.robot Resource payment_operations.robot Resource common_steps_acl_bearer.robot *** Variables *** -${POLICY} = REP 2 IN X CBF 1 SELECT 2 FROM * AS X -${ATTR_TIME} = Timestamp=new -${ATTR_DUPLICATE} = Size=small, Size=big -${ATTR_NONE} = NoAttribute='' -${ATTR_SINGLE} = AttrNum=one -${CONTAINER_WAIT_INTERVAL} = 1 min +&{ATTR_TIME} = Timestamp=new +&{ATTR_NONE} = NoAttribute= +&{ATTR_SINGLE} = AttrNum=one +${ERROR_MSG} = invalid container attribute *** Test Cases *** Duplicated Container Attributes [Documentation] Testcase to check duplicated container attributes. - [Tags] Container NeoFS NeoCLI - [Timeout] 10 min + [Tags] Container + [Timeout] 5 min [Setup] Setup @@ -32,30 +31,33 @@ Duplicated Container Attributes # Checking that container attributes cannot duplicate ###################################################### - Run Keyword And Expect Error * - ... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_TIME} - Run Keyword And Expect Error * - ... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_DUPLICATE} + # TODO: unstable case, the behaviour needs to be defined + # https://github.com/nspcc-dev/neofs-node/issues/1339 + #Run Keyword And Expect Error * + #... Create container ${WALLET} attributes=${ATTR_TIME} + + ${ERR} = Run Keyword And Expect Error * + ... Create Container ${WALLET} options=--attributes Size=small, Size=big + Should Contain ${ERR} ${ERROR_MSG} ###################################################### # Checking that container cannot have empty attribute ###################################################### - Run Keyword And Expect Error * - ... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_NONE} + # TODO: the same unstable case, referenced in the above issue + #${ERR} = Run Keyword And Expect Error * + # ... Create Container ${WALLET} attributes=${ATTR_NONE} + # Should Contain ${ERR} ${ERROR_MSG} ##################################################### # Checking a successful step with a single attribute ##################################################### - ${CID} = Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_SINGLE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} - ${ATTRIBUTES} = Get container attributes ${WALLET} ${CID} ${EMPTY} json_output=True - &{ATTRIBUTES_DICT} = Decode Container Attributes Json ${ATTRIBUTES} - List Should Contain Value - ... ${ATTRIBUTES_DICT}[Attributes] + ${CID} = Create Container ${WALLET} attributes=${ATTR_SINGLE} + &{ATTRIBUTES} = Get Container Attributes ${WALLET} ${CID} + Dictionary Should Contain Sub Dictionary + ... ${ATTRIBUTES} ... ${ATTR_SINGLE} - ... "No expected container attributes found" + ... msg="No expected container attributes found" [Teardown] Teardown container_attributes diff --git a/robot/testsuites/integration/container/container_delete.robot b/robot/testsuites/integration/container/container_delete.robot index 744adab..5334617 100644 --- a/robot/testsuites/integration/container/container_delete.robot +++ b/robot/testsuites/integration/container/container_delete.robot @@ -1,46 +1,49 @@ *** Settings *** Variables common.py -Variables wellknown_acl.py -Library neofs.py -Library payment_neogo.py +Library container.py Library wallet_keywords.py Library contract_keywords.py +Library Collections Resource setup_teardown.robot Resource payment_operations.robot -*** Variables *** -${CONTAINER_WAIT_INTERVAL} = 1 min - *** Test Cases *** Delete Containers - [Documentation] Testcase to check if containers can be deleted. + [Documentation] Testcase to check if containers can be deleted by its owner only. [Tags] Container - [Timeout] 10 min + [Timeout] 2 min [Setup] Setup ${_} ${_} ${USER_KEY} = Prepare Wallet And Deposit ${_} ${_} ${OTHER_KEY} = Prepare Wallet And Deposit - ${CID} = Create container ${USER_KEY} ${PRIVATE_ACL_F} ${COMMON_PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${USER_KEY} ${CID} + ${CID} = Create container ${USER_KEY} ################################################################ # No explicit error is expected upon container deletion attempt ################################################################ - Delete Container ${CID} ${OTHER_KEY} + Delete Container ${OTHER_KEY} ${CID} Tick Epoch - Get container attributes ${USER_KEY} ${CID} + @{CONTAINERS} = List Containers ${USER_KEY} + List Should Contain Value + ... ${CONTAINERS} + ... ${CID} + ... msg="A key which doesn't owe the container is able to delete ${CID}" - Delete Container ${CID} ${USER_KEY} + Delete Container ${USER_KEY} ${CID} Tick Epoch - Run Keyword And Expect Error * - ... Get container attributes ${USER_KEY} ${CID} + @{CONTAINERS} = List Containers ${USER_KEY} + List Should Not Contain Value + ... ${CONTAINERS} + ... ${CID} + ... msg="${CID} is still in container list" - Log If one tries to delete an already deleted container, they should expect success. - Delete Container ${CID} ${USER_KEY} + ################################################################################### + # If one tries to delete an already deleted container, they should expect success. + ################################################################################### + Delete Container ${USER_KEY} ${CID} - [Teardown] Teardown container_delete + [Teardown] Teardown container_delete diff --git a/robot/testsuites/integration/container/container_session_token.robot b/robot/testsuites/integration/container/container_session_token.robot index 0b3131b..d54a324 100644 --- a/robot/testsuites/integration/container/container_session_token.robot +++ b/robot/testsuites/integration/container/container_session_token.robot @@ -5,8 +5,10 @@ Variables wellknown_acl.py Resource setup_teardown.robot Resource payment_operations.robot -Library Process +Library container.py Library neofs.py + +Library Process Library String Library OperatingSystem @@ -29,17 +31,13 @@ Session Token for Container ${PUB_PART} = Get Line ${UTIL.stdout} 1 ${SESSION_TOKEN} = Generate Session Token ${OWNER} ${PUB_PART} wildcard=True + Sign Session token ${SESSION_TOKEN} ${WALLET} ${SIGNED_FILE} - Sign Session token ${SESSION_TOKEN} ${WALLET} ${SIGNED_FILE} - - ${CID} = Create Container ${GEN_WALLET} ${PRIVATE_ACL_F} ${COMMON_PLACEMENT_RULE} ${EMPTY} ${SIGNED_FILE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} - Run Keyword And Expect Error * - ... Container Existing ${GEN_WALLET} ${CID} + ${CID} = Create Container ${WALLET} basic_acl=${PRIVATE_ACL_F} + ... session_token=${SIGNED_FILE} session_wallet=${GEN_WALLET} ######################## -# Check container owner +# Check container owner ######################## ${CONTAINER_INFO} = Run Process ${NEOFS_CLI_EXEC} container get --cid ${CID} --wallet ${GEN_WALLET} --config ${WALLET_PASS} --rpc-endpoint ${NEOFS_ENDPOINT} shell=True @@ -47,4 +45,4 @@ Session Token for Container @{CID_OWNER_ID} = Split String ${CID_OWNER_ID_LINE} Should Be Equal As Strings ${OWNER} ${CID_OWNER_ID}[2] - [Teardown] Teardown container_session_token + [Teardown] Teardown container_session_token diff --git a/robot/testsuites/integration/network/netmap_control_drop.robot b/robot/testsuites/integration/network/netmap_control_drop.robot index 3382cb4..aa3a7e6 100644 --- a/robot/testsuites/integration/network/netmap_control_drop.robot +++ b/robot/testsuites/integration/network/netmap_control_drop.robot @@ -2,11 +2,12 @@ Variables common.py Variables wellknown_acl.py +Library container.py Library contract_keywords.py Library neofs.py Library neofs_verbs.py - Library payment_neogo.py + Library String Library Process @@ -15,13 +16,9 @@ Resource payment_operations.robot Resource storage.robot Resource complex_object_operations.robot -*** Variables *** -${CONTAINER_WAIT_INTERVAL} = 1 min - *** Test Cases *** Drop command in control group [Documentation] Testcase to check drop-objects command from control group. - [Tags] NeoFSCLI [Timeout] 10 min [Setup] Setup @@ -35,9 +32,8 @@ Drop command in control group ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${PRIV_CID} = Create container ${WALLET} ${PRIVATE_ACL_F} REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '${LOCODE}' AS LOC - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${PRIV_CID} + ${PRIV_CID} = Create container ${WALLET} basic_acl=${PRIVATE_ACL_F} + ... rule=REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '${LOCODE}' AS LOC ######################### # Dropping simple object diff --git a/robot/testsuites/integration/network/netmap_simple.robot b/robot/testsuites/integration/network/netmap_simple.robot index ccbf928..ceb7223 100644 --- a/robot/testsuites/integration/network/netmap_simple.robot +++ b/robot/testsuites/integration/network/netmap_simple.robot @@ -1,6 +1,7 @@ *** Settings *** Variables common.py +Library container.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py @@ -16,7 +17,7 @@ ${CONTAINER_WAIT_INTERVAL} = 1 min *** Test cases *** NeoFS Simple Netmap [Documentation] Testcase to validate NeoFS Netmap. - [Tags] Netmap NeoFS NeoCLI + [Tags] Netmap [Timeout] 20 min [Setup] Setup @@ -24,53 +25,53 @@ NeoFS Simple Netmap ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 IN X CBF 2 SELECT 2 FROM * AS X 2 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 2 IN X CBF 2 SELECT 2 FROM * AS X 2 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 IN X CBF 1 SELECT 2 FROM * AS X 2 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 2 IN X CBF 1 SELECT 2 FROM * AS X 2 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 3 IN X CBF 1 SELECT 3 FROM * AS X 3 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 3 IN X CBF 1 SELECT 3 FROM * AS X 3 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 IN X CBF 1 SELECT 1 FROM * AS X 1 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 1 IN X CBF 1 SELECT 1 FROM * AS X 1 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 IN X CBF 2 SELECT 1 FROM * AS X 1 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 1 IN X CBF 2 SELECT 1 FROM * AS X 1 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EMPTY} - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 IN X CBF 1 SELECT 4 FROM * AS X 2 @{EMPTY} + Validate Policy ${WALLET} ${FILE} REP 2 IN X CBF 1 SELECT 4 FROM * AS X 2 @{EMPTY} @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EXPECTED} @{EXPECTED} = Create List s03.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 IN LOC_PLACE CBF 1 SELECT 1 FROM LOC_SW AS LOC_PLACE FILTER Country EQ Sweden AS LOC_SW + Validate Policy ${WALLET} ${FILE} REP 1 IN LOC_PLACE CBF 1 SELECT 1 FROM LOC_SW AS LOC_PLACE FILTER Country EQ Sweden AS LOC_SW ... 1 @{EXPECTED} @{EXPECTED} = Create List s02.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB 1 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB 1 @{EXPECTED} @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 IN LOC_SPB_PLACE REP 1 IN LOC_MSK_PLACE CBF 1 SELECT 1 FROM LOC_SPB AS LOC_SPB_PLACE SELECT 1 FROM LOC_MSK AS LOC_MSK_PLACE FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB FILTER 'UN-LOCODE' EQ 'RU MOW' AS LOC_MSK + Validate Policy ${WALLET} ${FILE} REP 1 IN LOC_SPB_PLACE REP 1 IN LOC_MSK_PLACE CBF 1 SELECT 1 FROM LOC_SPB AS LOC_SPB_PLACE SELECT 1 FROM LOC_MSK AS LOC_MSK_PLACE FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB FILTER 'UN-LOCODE' EQ 'RU MOW' AS LOC_MSK ... 2 @{EXPECTED} @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 4 CBF 1 SELECT 4 FROM LOC_EU FILTER Continent EQ Europe AS LOC_EU 4 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 4 CBF 1 SELECT 4 FROM LOC_EU FILTER Continent EQ Europe AS LOC_EU 4 @{EXPECTED} @{EXPECTED} = Create List s02.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER 'UN-LOCODE' NE 'RU MOW' AND 'UN-LOCODE' NE 'SE STO' AND 'UN-LOCODE' NE 'FI HEL' AS LOC_SPB + Validate Policy ${WALLET} ${FILE} REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER 'UN-LOCODE' NE 'RU MOW' AND 'UN-LOCODE' NE 'SE STO' AND 'UN-LOCODE' NE 'FI HEL' AS LOC_SPB ... 1 @{EXPECTED} @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER SubDivCode NE 'AB' AND SubDivCode NE '18' AS LOC_RU 2 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER SubDivCode NE 'AB' AND SubDivCode NE '18' AS LOC_RU 2 @{EXPECTED} @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER Country EQ 'Russia' AS LOC_RU 2 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER Country EQ 'Russia' AS LOC_RU 2 @{EXPECTED} @{EXPECTED} = Create List s03.neofs.devenv:8080 s04.neofs.devenv:8080 - Validate Policy ${USER_WALLET} ${FILE_S} REP 2 CBF 1 SELECT 2 FROM LOC_EU FILTER Country NE 'Russia' AS LOC_EU 2 @{EXPECTED} + Validate Policy ${WALLET} ${FILE} REP 2 CBF 1 SELECT 2 FROM LOC_EU FILTER Country NE 'Russia' AS LOC_EU 2 @{EXPECTED} Log Put operation should be failed with error "not enough nodes to SELECT from: 'X'" Run Keyword And Expect Error * - ... Validate Policy ${USER_WALLET} ${FILE_S} REP 2 IN X CBF 2 SELECT 6 FROM * AS X 2 @{EMPTY} + ... Validate Policy ${WALLET} ${FILE} REP 2 IN X CBF 2 SELECT 6 FROM * AS X 2 @{EMPTY} [Teardown] Teardown netmap_simple @@ -81,9 +82,7 @@ Validate Policy Log Container with rule ${POLICY} - ${CID} = Create container ${WALLET} ${EMPTY} ${POLICY} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} + ${CID} = Create container ${WALLET} rule=${POLICY} ${S_OID} = Put object ${WALLET} ${FILE} ${CID} Validate storage policy for object ${WALLET} ${EXPECTED_VAL} ${CID} ${S_OID} ${EXPECTED_LIST} Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read diff --git a/robot/testsuites/integration/network/replication.robot b/robot/testsuites/integration/network/replication.robot index f615993..154f0aa 100644 --- a/robot/testsuites/integration/network/replication.robot +++ b/robot/testsuites/integration/network/replication.robot @@ -2,7 +2,7 @@ Variables common.py Variables wellknown_acl.py -Library Collections +Library container.py Library payment_neogo.py Library neofs.py Library neofs_verbs.py @@ -10,19 +10,19 @@ Library wallet_keywords.py Library rpc_call_keywords.py Library contract_keywords.py +Library Collections + Resource payment_operations.robot Resource setup_teardown.robot *** Variables *** -${PLACEMENT_RULE} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X ${EXPECTED_COPIES} = ${2} ${CHECK_INTERVAL} = 1 min -${CONTAINER_WAIT_INTERVAL} = 1 min *** Test cases *** NeoFS Object Replication [Documentation] Testcase to validate NeoFS object replication. - [Tags] Migration Replication NeoFS NeoCLI + [Tags] Migration Replication [Timeout] 25 min [Setup] Setup @@ -39,9 +39,7 @@ Check Replication [Arguments] ${ACL} ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container ${WALLET} ${ACL} ${PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} + ${CID} = Create Container ${WALLET} basic_acl=${ACL} ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${FILE_HASH} = Get file hash ${FILE} diff --git a/robot/testsuites/integration/object/object_attributes.robot b/robot/testsuites/integration/object/object_attributes.robot index b111605..2e390ba 100644 --- a/robot/testsuites/integration/object/object_attributes.robot +++ b/robot/testsuites/integration/object/object_attributes.robot @@ -2,17 +2,17 @@ Variables common.py Variables wellknown_acl.py -Library neofs.py -Library neofs_verbs.py -Library payment_neogo.py -Library String -Library Collections +Library container.py +Library neofs.py +Library neofs_verbs.py +Library payment_neogo.py +Library String +Library Collections Resource setup_teardown.robot Resource payment_operations.robot *** Variables *** -${POLICY} = REP 2 IN X CBF 1 SELECT 2 FROM * AS X &{ATTR_FILENAME} = FileName=new ${ATTR_DUPLICATE} = FileType=jpg,FileType=png &{ATTR_NONE} = NoAttribute='' @@ -22,14 +22,14 @@ ${ATTR_DUPLICATE} = FileType=jpg,FileType=png Duplicated Object Attributes [Documentation] Testcase to check duplicated attributes. - [Tags] Object NeoFS NeoCLI + [Tags] Object [Timeout] 10 min [Setup] Setup ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${PUBLIC_CID} = Create container ${WALLET} ${PUBLIC_ACL_F} ${POLICY} ${EMPTY} + ${PUBLIC_CID} = Create Container ${WALLET} basic_acl=${PUBLIC_ACL_F} ${FILE_S} = Generate file of bytes ${SIMPLE_OBJ_SIZE} @@ -61,4 +61,4 @@ Duplicated Object Attributes ... ${ATTR_SINGLE} ... msg="No expected User Attribute in HEAD response" - [Teardown] Teardown object_attributes + [Teardown] Teardown object_attributes diff --git a/robot/testsuites/integration/services/http_gate.robot b/robot/testsuites/integration/services/http_gate.robot index a936954..f6e7039 100644 --- a/robot/testsuites/integration/services/http_gate.robot +++ b/robot/testsuites/integration/services/http_gate.robot @@ -2,6 +2,7 @@ Variables common.py Variables wellknown_acl.py +Library container.py Library neofs.py Library neofs_verbs.py Library http_gate.py @@ -11,7 +12,6 @@ Resource setup_teardown.robot *** Variables *** ${PLACEMENT_RULE} = REP 1 IN X CBF 1 SELECT 1 FROM * AS X -${CONTAINER_WAIT_INTERVAL} = 1 min @{INCLUDE_SVC} = http_gate *** Test cases *** @@ -24,11 +24,7 @@ NeoFS HTTP Gateway Make Up ${INCLUDE_SVC} ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - - ${CID} = Create container ${WALLET} ${PUBLIC_ACL} ${PLACEMENT_RULE} - Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} - ... Container Existing ${WALLET} ${CID} - + ${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL} ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${FILE_L} = Generate file of bytes ${COMPLEX_OBJ_SIZE} ${FILE_HASH} = Get file hash ${FILE} diff --git a/robot/testsuites/integration/services/s3_gate_object.robot b/robot/testsuites/integration/services/s3_gate_object.robot index 252f2c1..62484b3 100644 --- a/robot/testsuites/integration/services/s3_gate_object.robot +++ b/robot/testsuites/integration/services/s3_gate_object.robot @@ -4,6 +4,7 @@ Variables common.py Library Collections Library OperatingSystem +Library container.py Library neofs.py Library s3_gate.py Library contract_keywords.py @@ -35,8 +36,8 @@ Objects in NeoFS S3 Gateway ... ${SEC_ACCESS_KEY} ... ${OWNER_PRIV_KEY} = Init S3 Credentials ${WALLET} - ${CONTEINERS_LIST} = Container List ${WALLET} - List Should Contain Value ${CONTEINERS_LIST} ${CID} + @{CONTAINERS_LIST} = List Containers ${WALLET} + List Should Contain Value ${CONTAINERS_LIST} ${CID} ${S3_CLIENT} = Config S3 client ${ACCESS_KEY_ID} ${SEC_ACCESS_KEY} @@ -64,10 +65,10 @@ Objects in NeoFS S3 Gateway #TODO: Solve the issue on CopyObject #260 https://github.com/nspcc-dev/neofs-s3-gw/issues/260 ${COPIED_OBJ_PATH} = Copy object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} - ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} + ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} List Should Contain Value ${LIST_S3_OBJECTS} ${COPIED_OBJ_PATH} ${COPIED_OBJ_PATH_2} = Copy object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${S3_OBJECT_KEY} - ${LIST_S3_OBJECTS_2} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET_2} + ${LIST_S3_OBJECTS_2} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET_2} List Should Contain Value ${LIST_S3_OBJECTS_2} ${COPIED_OBJ_PATH_2} Delete object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY}