added keywords library container.py extracted from neofs.py

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-04-25 12:53:20 +03:00 committed by Anastasia Prasolova
parent 14183dabfc
commit 3e749abcd0
18 changed files with 317 additions and 303 deletions

View file

@ -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]

View file

@ -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))

View file

@ -17,7 +17,6 @@ from robot.api.deco import keyword
from robot.api import logger from robot.api import logger
from cli_helpers import _run_with_passwd, _cmd_run from cli_helpers import _run_with_passwd, _cmd_run
import neofs_verbs
import json_transformers import json_transformers
ROBOT_AUTO_KEYWORDS = False 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}'") 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') @keyword('Verify Head Tombstone')
def verify_head_tombstone(wallet: str, cid: str, oid_ts: str, oid: str, addr: str): def verify_head_tombstone(wallet: str, cid: str, oid_ts: str, oid: str, addr: str):
# TODO: replace with HEAD from neofs_verbs.py # 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.") 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') @keyword('Get file hash')
def get_file_hash(filename : str): def get_file_hash(filename : str):
file_hash = _get_file_hash(filename) 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 return endpoint_num, endpoint_control, wif
@keyword('Get Locode') @keyword('Get Locode')
def get_locode(): def get_locode():
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values())) 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}") raise Exception(f"no Tombstone ID was parsed from command output: \t{output}")
return oid return oid
@keyword('Generate Session Token') @keyword('Generate Session Token')
def generate_session_token(owner: str, pub_key: str, cid: str = "", wildcard: bool = False) -> str: 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()}") logger.info(f"Hash: {hash.hexdigest()}")
return 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): 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}") raise Exception(f"no OID was parsed from command output: \t{snd_str}")
return splitted[1] 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): def _search_object(node:str, wallet: str, cid:str, oid: str):
Cmd = ( Cmd = (

View file

@ -9,11 +9,11 @@ import os
import re import re
import random import random
import uuid import uuid
from functools import reduce
from common import NEOFS_ENDPOINT, ASSETS_DIR, NEOFS_NETMAP, WALLET_PASS from common import NEOFS_ENDPOINT, ASSETS_DIR, NEOFS_NETMAP, WALLET_PASS
from cli_helpers import _cmd_run from cli_helpers import _cmd_run
import json_transformers import json_transformers
from data_formatters import dict_to_attrs
from robot.api.deco import keyword from robot.api.deco import keyword
from robot.api import logger 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'{NEOFS_CLI_EXEC} --rpc-endpoint {endpoint} --wallet {wallet} '
f'object put --file {path} --cid {cid} {options} --config {WALLET_PASS} ' f'object put --file {path} --cid {cid} {options} --config {WALLET_PASS} '
f'{"--bearer " + bearer if bearer else ""} ' 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) output = _cmd_run(cmd)
# splitting CLI output to lines and taking the penultimate line # 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") logger.info("decoding simple header")
return json_transformers.decode_simple_header(decoded) 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))

View file

@ -2,30 +2,23 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py
*** Keywords *** *** Keywords ***
Create Private Container Create Private Container
[Arguments] ${USER_KEY} [Arguments] ${USER_KEY}
Log Create Private Container ${PRIV_CID_GEN} = Create container ${USER_KEY} basic_acl=${PRIVATE_ACL_F}
${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}
[Return] ${PRIV_CID_GEN} [Return] ${PRIV_CID_GEN}
Create Public Container Create Public Container
[Arguments] ${USER_KEY} [Arguments] ${USER_KEY}
Log Create Public Container ${PUBLIC_CID_GEN} = Create container ${USER_KEY} basic_acl=${PUBLIC_ACL_F}
${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} [Return] ${PUBLIC_CID_GEN}
Create Read-Only Container Create Read-Only Container
[Arguments] ${USER_KEY} [Arguments] ${USER_KEY}
Log Create Read-Only Container ${READONLY_CID_GEN} = Create container ${USER_KEY} basic_acl=${READONLY_ACL_F}
${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}
[Return] ${READONLY_CID_GEN} [Return] ${READONLY_CID_GEN}

View file

@ -2,20 +2,18 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py
*** Keywords *** *** Keywords ***
Create Container Public Create Container Public
[Arguments] ${USER_KEY} [Arguments] ${USER_KEY}
${PUBLIC_CID_GEN} = Create container ${USER_KEY} ${PUBLIC_ACL} ${COMMON_PLACEMENT_RULE} ${PUBLIC_CID_GEN} = Create container ${USER_KEY} basic_acl=${PUBLIC_ACL}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${USER_KEY} ${PUBLIC_CID_GEN}
[Return] ${PUBLIC_CID_GEN} [Return] ${PUBLIC_CID_GEN}
Create Container Inaccessible Create Container Inaccessible
[Arguments] ${USER_KEY} [Arguments] ${USER_KEY}
${INACCESSIBLE_CID_GEN} = Create container ${USER_KEY} ${INACCESSIBLE_ACL} ${COMMON_PLACEMENT_RULE} ${INACCESSIBLE_CID_GEN} = Create container ${USER_KEY} basic_acl=${INACCESSIBLE_ACL}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${USER_KEY} ${INACCESSIBLE_CID_GEN}
[Return] ${INACCESSIBLE_CID_GEN} [Return] ${INACCESSIBLE_CID_GEN}

View file

@ -3,28 +3,27 @@ Variables common.py
Variables eacl_object_filters.py Variables eacl_object_filters.py
Library acl.py Library acl.py
Library container.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library Collections Library Collections
Resource common_steps_acl_basic.robot Resource common_steps_acl_basic.robot
Resource payment_operations.robot Resource payment_operations.robot
*** Variables *** *** Variables ***
&{USER_HEADER} = key1=1 key2=abc &{USER_HEADER} = key1=1 key2=abc
&{USER_HEADER_DEL} = key1=del key2=del &{USER_HEADER_DEL} = key1=del key2=del
&{ANOTHER_HEADER} = key1=oth key2=oth &{ANOTHER_HEADER} = key1=oth key2=oth
${OBJECT_PATH} = testfile ${OBJECT_PATH} = testfile
${EACL_ERR_MSG} = * ${EACL_ERR_MSG} = *
*** Keywords *** *** Keywords ***
Create Container Public Create Container Public
[Arguments] ${WALLET} [Arguments] ${WALLET}
Log Create Public Container ${PUBLIC_CID_GEN} = Create container ${WALLET} basic_acl=${PUBLIC_ACL}
${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}
[Return] ${PUBLIC_CID_GEN} [Return] ${PUBLIC_CID_GEN}
Generate files Generate files
@ -125,8 +124,8 @@ Check eACL Filters with MatchType String Equal
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET} ${CID} = Create Container Public ${WALLET}
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} ${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID}

View file

@ -1,22 +1,16 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library container.py
Library wallet_keywords.py Library wallet_keywords.py
Library rpc_call_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 *** *** Keywords ***
Prepare container Prepare container
[Arguments] ${WIF} ${WALLET} [Arguments] ${WIF} ${WALLET}
${NEOFS_BALANCE} = Get NeoFS Balance ${WIF} ${NEOFS_BALANCE} = Get NeoFS Balance ${WIF}
${CID} = Create container ${WALLET}
${CID} = Create container ${WALLET} ${EMPTY} ${PLACEMENT_RULE}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${WALLET} ${CID}
${NEW_NEOFS_BALANCE} = Get NeoFS Balance ${WIF} ${NEW_NEOFS_BALANCE} = Get NeoFS Balance ${WIF}
Should Be True ${NEW_NEOFS_BALANCE} < ${NEOFS_BALANCE} Should Be True ${NEW_NEOFS_BALANCE} < ${NEOFS_BALANCE}

View file

@ -1,15 +1,16 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library Collections Library container.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library acl.py Library acl.py
Library payment_neogo.py Library payment_neogo.py
Library contract_keywords.py Library contract_keywords.py
Library wallet_keywords.py Library wallet_keywords.py
Library Collections
Resource eacl_tables.robot Resource eacl_tables.robot
Resource common_steps_acl_bearer.robot Resource common_steps_acl_bearer.robot
Resource payment_operations.robot Resource payment_operations.robot
@ -25,7 +26,7 @@ ${DEPOSIT} = ${30}
*** Test cases *** *** Test cases ***
eACL Deny Replication Operations eACL Deny Replication Operations
[Documentation] Testcase to validate NeoFS replication with eACL deny rules. [Documentation] Testcase to validate NeoFS replication with eACL deny rules.
[Tags] ACL NeoFS_CLI Replication [Tags] ACL Replication
[Timeout] 20 min [Timeout] 20 min
[Setup] Setup [Setup] Setup
@ -35,16 +36,11 @@ eACL Deny Replication Operations
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
Log Check Replication with eACL deny - object should be replicated
# https://github.com/nspcc-dev/neofs-node/issues/881 # https://github.com/nspcc-dev/neofs-node/issues/881
${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE}
${CID} = Create container ${WALLET} basic_acl=${PUBLIC_ACL} rule=${FULL_PLACEMENT_RULE}
${CID} = Create container ${WALLET} ${PUBLIC_ACL} ${FULL_PLACEMENT_RULE} Prepare eACL Role rules ${CID}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${WALLET} ${CID}
Prepare eACL Role rules ${CID}
${OID} = Put object ${WALLET} ${FILE} ${CID} ${OID} = Put object ${WALLET} ${FILE} ${CID}

View file

@ -1,28 +1,27 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library neofs.py Library container.py
Library payment_neogo.py Library neofs.py
Library String Library payment_neogo.py
Library Collections Library String
Library Collections
Resource setup_teardown.robot Resource setup_teardown.robot
Resource payment_operations.robot Resource payment_operations.robot
Resource common_steps_acl_bearer.robot Resource common_steps_acl_bearer.robot
*** Variables *** *** Variables ***
${POLICY} = REP 2 IN X CBF 1 SELECT 2 FROM * AS X &{ATTR_TIME} = Timestamp=new
${ATTR_TIME} = Timestamp=new &{ATTR_NONE} = NoAttribute=
${ATTR_DUPLICATE} = Size=small, Size=big &{ATTR_SINGLE} = AttrNum=one
${ATTR_NONE} = NoAttribute='' ${ERROR_MSG} = invalid container attribute
${ATTR_SINGLE} = AttrNum=one
${CONTAINER_WAIT_INTERVAL} = 1 min
*** Test Cases *** *** Test Cases ***
Duplicated Container Attributes Duplicated Container Attributes
[Documentation] Testcase to check duplicated container attributes. [Documentation] Testcase to check duplicated container attributes.
[Tags] Container NeoFS NeoCLI [Tags] Container
[Timeout] 10 min [Timeout] 5 min
[Setup] Setup [Setup] Setup
@ -32,30 +31,33 @@ Duplicated Container Attributes
# Checking that container attributes cannot duplicate # Checking that container attributes cannot duplicate
###################################################### ######################################################
Run Keyword And Expect Error * # TODO: unstable case, the behaviour needs to be defined
... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_TIME} # https://github.com/nspcc-dev/neofs-node/issues/1339
Run Keyword And Expect Error * #Run Keyword And Expect Error *
... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_DUPLICATE} #... 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 # Checking that container cannot have empty attribute
###################################################### ######################################################
Run Keyword And Expect Error * # TODO: the same unstable case, referenced in the above issue
... Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_NONE} #${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 # Checking a successful step with a single attribute
##################################################### #####################################################
${CID} = Create container ${WALLET} ${EMPTY} ${POLICY} ${ATTR_SINGLE} ${CID} = Create Container ${WALLET} attributes=${ATTR_SINGLE}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} &{ATTRIBUTES} = Get Container Attributes ${WALLET} ${CID}
... Container Existing ${WALLET} ${CID} Dictionary Should Contain Sub Dictionary
${ATTRIBUTES} = Get container attributes ${WALLET} ${CID} ${EMPTY} json_output=True ... ${ATTRIBUTES}
&{ATTRIBUTES_DICT} = Decode Container Attributes Json ${ATTRIBUTES}
List Should Contain Value
... ${ATTRIBUTES_DICT}[Attributes]
... ${ATTR_SINGLE} ... ${ATTR_SINGLE}
... "No expected container attributes found" ... msg="No expected container attributes found"
[Teardown] Teardown container_attributes [Teardown] Teardown container_attributes

View file

@ -1,46 +1,49 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Variables wellknown_acl.py
Library neofs.py Library container.py
Library payment_neogo.py
Library wallet_keywords.py Library wallet_keywords.py
Library contract_keywords.py Library contract_keywords.py
Library Collections
Resource setup_teardown.robot Resource setup_teardown.robot
Resource payment_operations.robot Resource payment_operations.robot
*** Variables ***
${CONTAINER_WAIT_INTERVAL} = 1 min
*** Test Cases *** *** Test Cases ***
Delete Containers 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 [Tags] Container
[Timeout] 10 min [Timeout] 2 min
[Setup] Setup [Setup] Setup
${_} ${_} ${USER_KEY} = Prepare Wallet And Deposit ${_} ${_} ${USER_KEY} = Prepare Wallet And Deposit
${_} ${_} ${OTHER_KEY} = Prepare Wallet And Deposit ${_} ${_} ${OTHER_KEY} = Prepare Wallet And Deposit
${CID} = Create container ${USER_KEY} ${PRIVATE_ACL_F} ${COMMON_PLACEMENT_RULE} ${CID} = Create container ${USER_KEY}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${USER_KEY} ${CID}
################################################################ ################################################################
# No explicit error is expected upon container deletion attempt # No explicit error is expected upon container deletion attempt
################################################################ ################################################################
Delete Container ${CID} ${OTHER_KEY} Delete Container ${OTHER_KEY} ${CID}
Tick Epoch 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 Tick Epoch
Run Keyword And Expect Error * @{CONTAINERS} = List Containers ${USER_KEY}
... Get container attributes ${USER_KEY} ${CID} 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

View file

@ -5,8 +5,10 @@ Variables wellknown_acl.py
Resource setup_teardown.robot Resource setup_teardown.robot
Resource payment_operations.robot Resource payment_operations.robot
Library Process Library container.py
Library neofs.py Library neofs.py
Library Process
Library String Library String
Library OperatingSystem Library OperatingSystem
@ -29,14 +31,10 @@ Session Token for Container
${PUB_PART} = Get Line ${UTIL.stdout} 1 ${PUB_PART} = Get Line ${UTIL.stdout} 1
${SESSION_TOKEN} = Generate Session Token ${OWNER} ${PUB_PART} wildcard=True ${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 ${WALLET} basic_acl=${PRIVATE_ACL_F}
... session_token=${SIGNED_FILE} session_wallet=${GEN_WALLET}
${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}
######################## ########################
# Check container owner # Check container owner

View file

@ -2,11 +2,12 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py
Library contract_keywords.py Library contract_keywords.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library payment_neogo.py Library payment_neogo.py
Library String Library String
Library Process Library Process
@ -15,13 +16,9 @@ Resource payment_operations.robot
Resource storage.robot Resource storage.robot
Resource complex_object_operations.robot Resource complex_object_operations.robot
*** Variables ***
${CONTAINER_WAIT_INTERVAL} = 1 min
*** Test Cases *** *** Test Cases ***
Drop command in control group Drop command in control group
[Documentation] Testcase to check drop-objects command from control group. [Documentation] Testcase to check drop-objects command from control group.
[Tags] NeoFSCLI
[Timeout] 10 min [Timeout] 10 min
[Setup] Setup [Setup] Setup
@ -35,9 +32,8 @@ Drop command in control group
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${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 ${PRIV_CID} = Create container ${WALLET} basic_acl=${PRIVATE_ACL_F}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} ... rule=REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '${LOCODE}' AS LOC
... Container Existing ${WALLET} ${PRIV_CID}
######################### #########################
# Dropping simple object # Dropping simple object

View file

@ -1,6 +1,7 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library container.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library payment_neogo.py Library payment_neogo.py
@ -16,7 +17,7 @@ ${CONTAINER_WAIT_INTERVAL} = 1 min
*** Test cases *** *** Test cases ***
NeoFS Simple Netmap NeoFS Simple Netmap
[Documentation] Testcase to validate NeoFS Netmap. [Documentation] Testcase to validate NeoFS Netmap.
[Tags] Netmap NeoFS NeoCLI [Tags] Netmap
[Timeout] 20 min [Timeout] 20 min
[Setup] Setup [Setup] Setup
@ -24,53 +25,53 @@ NeoFS Simple Netmap
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${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 @{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 @{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} ... 1 @{EXPECTED}
@{EXPECTED} = Create List s02.neofs.devenv:8080 @{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 @{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} ... 2 @{EXPECTED}
@{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 @{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 @{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} ... 1 @{EXPECTED}
@{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 @{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 @{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 @{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'" Log Put operation should be failed with error "not enough nodes to SELECT from: 'X'"
Run Keyword And Expect Error * 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 [Teardown] Teardown netmap_simple
@ -81,9 +82,7 @@ Validate Policy
Log Container with rule ${POLICY} Log Container with rule ${POLICY}
${CID} = Create container ${WALLET} ${EMPTY} ${POLICY} ${CID} = Create container ${WALLET} rule=${POLICY}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${WALLET} ${CID}
${S_OID} = Put object ${WALLET} ${FILE} ${CID} ${S_OID} = Put object ${WALLET} ${FILE} ${CID}
Validate storage policy for object ${WALLET} ${EXPECTED_VAL} ${CID} ${S_OID} ${EXPECTED_LIST} Validate storage policy for object ${WALLET} ${EXPECTED_VAL} ${CID} ${S_OID} ${EXPECTED_LIST}
Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read

View file

@ -2,7 +2,7 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library Collections Library container.py
Library payment_neogo.py Library payment_neogo.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
@ -10,19 +10,19 @@ Library wallet_keywords.py
Library rpc_call_keywords.py Library rpc_call_keywords.py
Library contract_keywords.py Library contract_keywords.py
Library Collections
Resource payment_operations.robot Resource payment_operations.robot
Resource setup_teardown.robot Resource setup_teardown.robot
*** Variables *** *** Variables ***
${PLACEMENT_RULE} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
${EXPECTED_COPIES} = ${2} ${EXPECTED_COPIES} = ${2}
${CHECK_INTERVAL} = 1 min ${CHECK_INTERVAL} = 1 min
${CONTAINER_WAIT_INTERVAL} = 1 min
*** Test cases *** *** Test cases ***
NeoFS Object Replication NeoFS Object Replication
[Documentation] Testcase to validate NeoFS object replication. [Documentation] Testcase to validate NeoFS object replication.
[Tags] Migration Replication NeoFS NeoCLI [Tags] Migration Replication
[Timeout] 25 min [Timeout] 25 min
[Setup] Setup [Setup] Setup
@ -39,9 +39,7 @@ Check Replication
[Arguments] ${ACL} [Arguments] ${ACL}
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container ${WALLET} ${ACL} ${PLACEMENT_RULE} ${CID} = Create Container ${WALLET} basic_acl=${ACL}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${WALLET} ${CID}
${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE}
${FILE_HASH} = Get file hash ${FILE} ${FILE_HASH} = Get file hash ${FILE}

View file

@ -2,17 +2,17 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library neofs.py Library container.py
Library neofs_verbs.py Library neofs.py
Library payment_neogo.py Library neofs_verbs.py
Library String Library payment_neogo.py
Library Collections Library String
Library Collections
Resource setup_teardown.robot Resource setup_teardown.robot
Resource payment_operations.robot Resource payment_operations.robot
*** Variables *** *** Variables ***
${POLICY} = REP 2 IN X CBF 1 SELECT 2 FROM * AS X
&{ATTR_FILENAME} = FileName=new &{ATTR_FILENAME} = FileName=new
${ATTR_DUPLICATE} = FileType=jpg,FileType=png ${ATTR_DUPLICATE} = FileType=jpg,FileType=png
&{ATTR_NONE} = NoAttribute='' &{ATTR_NONE} = NoAttribute=''
@ -22,14 +22,14 @@ ${ATTR_DUPLICATE} = FileType=jpg,FileType=png
Duplicated Object Attributes Duplicated Object Attributes
[Documentation] Testcase to check duplicated attributes. [Documentation] Testcase to check duplicated attributes.
[Tags] Object NeoFS NeoCLI [Tags] Object
[Timeout] 10 min [Timeout] 10 min
[Setup] Setup [Setup] Setup
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${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} ${FILE_S} = Generate file of bytes ${SIMPLE_OBJ_SIZE}
@ -61,4 +61,4 @@ Duplicated Object Attributes
... ${ATTR_SINGLE} ... ${ATTR_SINGLE}
... msg="No expected User Attribute in HEAD response" ... msg="No expected User Attribute in HEAD response"
[Teardown] Teardown object_attributes [Teardown] Teardown object_attributes

View file

@ -2,6 +2,7 @@
Variables common.py Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py
Library neofs.py Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library http_gate.py Library http_gate.py
@ -11,7 +12,6 @@ Resource setup_teardown.robot
*** Variables *** *** Variables ***
${PLACEMENT_RULE} = REP 1 IN X CBF 1 SELECT 1 FROM * AS X ${PLACEMENT_RULE} = REP 1 IN X CBF 1 SELECT 1 FROM * AS X
${CONTAINER_WAIT_INTERVAL} = 1 min
@{INCLUDE_SVC} = http_gate @{INCLUDE_SVC} = http_gate
*** Test cases *** *** Test cases ***
@ -24,11 +24,7 @@ NeoFS HTTP Gateway
Make Up ${INCLUDE_SVC} Make Up ${INCLUDE_SVC}
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL}
${CID} = Create container ${WALLET} ${PUBLIC_ACL} ${PLACEMENT_RULE}
Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL}
... Container Existing ${WALLET} ${CID}
${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} ${FILE} = Generate file of bytes ${SIMPLE_OBJ_SIZE}
${FILE_L} = Generate file of bytes ${COMPLEX_OBJ_SIZE} ${FILE_L} = Generate file of bytes ${COMPLEX_OBJ_SIZE}
${FILE_HASH} = Get file hash ${FILE} ${FILE_HASH} = Get file hash ${FILE}

View file

@ -4,6 +4,7 @@ Variables common.py
Library Collections Library Collections
Library OperatingSystem Library OperatingSystem
Library container.py
Library neofs.py Library neofs.py
Library s3_gate.py Library s3_gate.py
Library contract_keywords.py Library contract_keywords.py
@ -35,8 +36,8 @@ Objects in NeoFS S3 Gateway
... ${SEC_ACCESS_KEY} ... ${SEC_ACCESS_KEY}
... ${OWNER_PRIV_KEY} = Init S3 Credentials ${WALLET} ... ${OWNER_PRIV_KEY} = Init S3 Credentials ${WALLET}
${CONTEINERS_LIST} = Container List ${WALLET} @{CONTAINERS_LIST} = List Containers ${WALLET}
List Should Contain Value ${CONTEINERS_LIST} ${CID} List Should Contain Value ${CONTAINERS_LIST} ${CID}
${S3_CLIENT} = Config S3 client ${ACCESS_KEY_ID} ${SEC_ACCESS_KEY} ${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 #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} ${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} 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} ${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} List Should Contain Value ${LIST_S3_OBJECTS_2} ${COPIED_OBJ_PATH_2}
Delete object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} Delete object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY}