diff --git a/README.md b/README.md index 0d179ee6..baf696c3 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,98 @@ -## Запуск тесткейсов +## Testcases execution -### Первичная подготовка +### Initial preparation -1. Установить neofs-cli +1. Install neofs-cli - `git clone git@github.com:nspcc-dev/neofs-node.git` - `cd neofs-node` - `make` - `sudo cp bin/neofs-cli /usr/local/bin/neofs-cli` or add alias path to bin/neofs-cli -2. Установить cdn-authmate +2. Install cdn-authmate - `git clone git@github.com:nspcc-dev/cdn-authmate.git` - `cd cdn-authmate` - `make build` - `sudo cp bin/cdn-authmate /usr/local/bin/cdn-authmate` or add alias path to bin/cdn-authmate -3. Устаносить зависимости для Testcases +3. Install Testcases dependencies - `pip3 install robotframework` - `pip3 install pexpect` - `pip3 install requests` - `pip3 install boto3` + - `pip3 install docker` -(pip3 заменить на соответсвующий менеджер пакетов python в системе). +(replace pip3 with the appropriate python package manager on the system). -При этом должен быть запущен dev-env с тестируемым окружением. +In this case, dev-env should be running with the tested environment. -### Запуск тесткейсов +### Run -1. Выполнить `make run` +1. Execute the command `make run` -2. Логи будут доступны в папке artifacts/ после завершения тестов с любым из статусов. +2. Logs will be available in the artifacts/ directory after tests with any of the statuses are completed. -### Запуск произвольного тесткейса +### Running an arbitrary test case -Для запуска произвольного тесткейса нужно выполнить команду: +To run an arbitrary testcase, you need to run the command: `robot --timestampoutputs --outputdir artifacts/ robot/testsuites/integration/.robot ` -Для запуска доступны следущие сценарии: +The following scripts are available for execution: - * acl_basic.robot - базовый ACL - * acl_extended.robot - extended ACL - * acl_baearer.robot - Bearer Token ACL - * object_complex.robot - операции над простым объектом - * object_simple.robot - операции над большим объектом - * withdraw.robot - оперция Deposit и Withdraw с счета NeoFS - * netmap_simple.robot - проверка Placement policy - * replication.robot - базовый тесткейс проверки репликации объектов - * http_gate.robot - проверка HTTP-gate и интеграции с NeoFS - * s3_gate.robot - проверка S3-gate и интеграции с NeoFS + * acl_basic.robot + * acl_extended.robot + * acl_baearer.robot + * object_complex.robot + * object_simple.robot + * withdraw.robot + * netmap_simple.robot + * replication.robot + * http_gate.robot + * s3_gate.robot -## Запуск smoke-тестов +## Smoke test execution -Есть сьют со smoke-тестами для CDN-гейтов `robot/testsuites/smoke/selectelcdn_smoke.robot`. +There is a suite with smoke tests for CDN gates `robot/testsuites/smoke/selectelcdn_smoke.robot`. -По умолчанию кейворды используют переменные из файла `robot/resources/lib/neofs_int_vars.py`. +By default, keywords use variables from a file `robot/resources/lib/neofs_int_vars.py`. ``` robot --outputdir artifacts/ robot/testsuites/smoke/selectelcdn_smoke.robot ``` -### Первичная подготовка +### Initial preparation -1. Ему требуются отдельные переменные, в отличие от сьютов NeoFS, которые запускаются на -девэнве. Чтобы библиотеки кейвордов их использовали, нужно установить переменную -окружения +1. It requires separate variables, unlike the NeoFS suites, which run on +dev-env. In order for the keyword libraries to use them, you need to set the environment variable ``` export ROBOT_PROFILE=selectel_smoke ``` -Dev-env не нужен. Но нужно установить neo-go. +Dev-env is not needed. But you need to install neo-go. -2. Установить neo-go +2. Install neo-go - `git clone git@github.com:nspcc-dev/neo-go.git` - `cd neo-go` - `make` - `sudo cp bin/neo-go /usr/local/bin/neo-go` or add alias path to bin/neo-go +3. To run smoke test: `robot --timestampoutputs --outputdir artifacts/ robot/testsuites/smoke/selectelcdn_smoke.robot` -## Генерация документации -Для генерации документации по шагам: +## Generation of documentation + +To generate Keywords documentation: ``` python3 -m robot.libdoc robot/resources/lib/neofs.py docs/NeoFS_Library.html python3 -m robot.libdoc robot/resources/lib/payment_neogo.py docs/Payment_Library.html ``` -Для генерации документации по тесткейсам: +To generate testcases documentation: ``` python3 -m robot.testdoc robot/testsuites/integration/ docs/testcases.html ``` -## Создание тесткейсов +## Testcases implementation ### Source code overview @@ -102,11 +104,11 @@ python3 -m robot.testdoc robot/testsuites/integration/ docs/testcases.html `robot/variables/` - All variables for tests. It is possible to add the auto-loading logic of parameters from the smart-contract in the future. Contain python files. -`robot/testsuites/` - Robot Test Suites and Test Cases. +`robot/testsuites/` - Robot TestSuites and TestCases. -`robot/testsuites/integration/` - Integration test suites and test cases +`robot/testsuites/integration/` - Integration test suites and testcases -`robot/testsuites/fi/` - Fault Injection test suites and test cases +`robot/testsuites/fi/` - Fault Injection testsuites and testcases ### Code style @@ -129,7 +131,7 @@ On keywords definition, one should specify variable type, e.g. path: str ### Robot style -Следует всегда заполнять секции [Tags] и [Documentation] для Testcase'ов и Documentation для Test Suite'ов. +You should always complete the [Tags] and [Documentation] sections for Testcases and Documentation for Test Suites. ### Robot-framework User Guide diff --git a/keys/s3_selectel_hcs.pub.key b/keys/s3_selectel_hcs.pub.key new file mode 100644 index 00000000..3c6b4982 --- /dev/null +++ b/keys/s3_selectel_hcs.pub.key @@ -0,0 +1 @@ +=b|vnb%a-ie= \ No newline at end of file diff --git a/robot/resources/lib/gates.py b/robot/resources/lib/gates.py index 4bb96f39..f360b331 100644 --- a/robot/resources/lib/gates.py +++ b/robot/resources/lib/gates.py @@ -33,7 +33,7 @@ def init_s3_credentials(private_key: str, s3_key): logger.info("Cmd: %s" % Cmd) try: complProc = subprocess.run(Cmd, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=360, shell=True) output = complProc.stdout logger.info("Output: %s" % output) diff --git a/robot/resources/lib/neofs.py b/robot/resources/lib/neofs.py index feab93b7..28a2454d 100644 --- a/robot/resources/lib/neofs.py +++ b/robot/resources/lib/neofs.py @@ -9,13 +9,16 @@ import hashlib from robot.api.deco import keyword from robot.api import logger import random +import base64 +import base58 +import docker if os.getenv('ROBOT_PROFILE') == 'selectel_smoke': from selectelcdn_smoke_vars import (NEOGO_CLI_PREFIX, NEO_MAINNET_ENDPOINT, - NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT) + NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, NEOFS_NETMAP) else: from neofs_int_vars import (NEOGO_CLI_PREFIX, NEO_MAINNET_ENDPOINT, - NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT) + NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, NEOFS_NETMAP) ROBOT_AUTO_KEYWORDS = False @@ -64,22 +67,13 @@ def stop_nodes(down_num: int, *nodes_list): # select nodes to stop from list stop_nodes = random.sample(nodes_list, down_num) - + for node in stop_nodes: m = re.search(r'(s\d+).', node) node = m.group(1) - Cmd = f'docker stop {node}' - logger.info("Cmd: %s" % Cmd) - - try: - complProc = subprocess.run(Cmd, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True) - output = complProc.stdout - logger.info("Output: %s" % output) - - except subprocess.CalledProcessError as e: - raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output)) + client = docker.APIClient() + client.stop(node) return stop_nodes @@ -90,20 +84,9 @@ def start_nodes(*nodes_list): for node in nodes_list: m = re.search(r'(s\d+).', node) node = m.group(1) - - Cmd = f'docker start {node}' - logger.info("Cmd: %s" % Cmd) - - try: - complProc = subprocess.run(Cmd, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True) - output = complProc.stdout - logger.info("Output: %s" % output) - - except subprocess.CalledProcessError as e: - raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output)) - - + client = docker.APIClient() + client.start(node) + @keyword('Get nodes with object') def get_nodes_with_object(private_key: str, cid: str, oid: str): storage_nodes = _get_storage_nodes(private_key) @@ -205,6 +188,10 @@ def form_bearertoken_file_for_all_ops(file_name: str, private_key: str, cid: str eacl = get_eacl(private_key, cid) input_records = "" + + cid_base58_b = base58.b58decode(cid) + cid_base64 = base64.b64encode(cid_base58_b).decode("utf-8") + if eacl: res_json = re.split(r'[\s\n]+\][\s\n]+\}[\s\n]+Signature:', eacl) records = re.split(r'"records": \[', res_json[0]) @@ -215,7 +202,7 @@ def form_bearertoken_file_for_all_ops(file_name: str, private_key: str, cid: str "body": { "eaclTable": { "containerID": { - "value": \"""" + cid + """" + "value": \"""" + str(cid_base64) + """" }, "records": [ { @@ -317,6 +304,10 @@ def form_bearertoken_file_filter_for_all_ops(file_name: str, private_key: str, c # SEARCH should be allowed without filters to use GET, HEAD, DELETE, and SEARCH? Need to clarify. eacl = get_eacl(private_key, cid) + + cid_base58_b = base58.b58decode(cid) + cid_base64 = base64.b64encode(cid_base58_b).decode("utf-8") + input_records = "" if eacl: res_json = re.split(r'[\s\n]+\][\s\n]+\}[\s\n]+Signature:', eacl) @@ -328,7 +319,7 @@ def form_bearertoken_file_filter_for_all_ops(file_name: str, private_key: str, c "body": { "eaclTable": { "containerID": { - "value": \"""" + cid + """" + "value": \"""" + str(cid_base64) + """" }, "records": [ { @@ -535,7 +526,7 @@ def create_container(private_key: str, basic_acl:str="", rule:str="REP 2 IN X CB createContainerCmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} container create --policy "{rule}" {basic_acl} --await' logger.info("Cmd: %s" % createContainerCmd) complProc = subprocess.run(createContainerCmd, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=300, shell=True) output = complProc.stdout logger.info("Output: %s" % output) cid = _parse_cid(output) @@ -816,9 +807,10 @@ def delete_object(private_key: str, cid: str, oid: str, bearer: str): bearer_token = f"--bearer {bearer}" ObjectCmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} object delete --cid {cid} --oid {oid} {bearer_token}' + logger.info("Cmd: %s" % ObjectCmd) try: complProc = subprocess.run(ObjectCmd, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30, shell=True) logger.info("Output: %s" % complProc.stdout) except subprocess.CalledProcessError as e: raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output)) @@ -995,7 +987,7 @@ def _parse_cid(output: str): return cid def _get_storage_nodes(private_key: bytes): - storage_nodes = ['s01.neofs.devenv:8080', 's02.neofs.devenv:8080','s03.neofs.devenv:8080','s04.neofs.devenv:8080'] + #storage_nodes = ['s01.neofs.devenv:8080', 's02.neofs.devenv:8080','s03.neofs.devenv:8080','s04.neofs.devenv:8080'] #NetmapCmd = f'{CLI_PREFIX}neofs-cli --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} status netmap' #complProc = subprocess.run(NetmapCmd, check=True, universal_newlines=True, # stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True) @@ -1011,8 +1003,8 @@ def _get_storage_nodes(private_key: bytes): # Will be fixed when netmap will be added to cli #storage_nodes.append() - logger.info("Storage nodes: %s" % storage_nodes) - return storage_nodes + logger.info("Storage nodes: %s" % NEOFS_NETMAP) + return NEOFS_NETMAP def _search_object(node:str, private_key: str, cid:str, oid: str): diff --git a/robot/resources/lib/neofs_int_vars.py b/robot/resources/lib/neofs_int_vars.py index a00e7b06..a97619d9 100644 --- a/robot/resources/lib/neofs_int_vars.py +++ b/robot/resources/lib/neofs_int_vars.py @@ -8,3 +8,5 @@ NEO_MAINNET_ENDPOINT = "main_chain.neofs.devenv:30333" NEOFS_NEO_API_ENDPOINT = 'http://main_chain.neofs.devenv:30333' HTTP_GATE = 'http://http.neofs.devenv' S3_GATE = 'https://s3.neofs.devenv:8080' +NEOFS_CONTRACT = "5f490fbd8010fd716754073ee960067d28549b7d" +NEOFS_NETMAP = ['s01.neofs.devenv:8080', 's02.neofs.devenv:8080','s03.neofs.devenv:8080','s04.neofs.devenv:8080'] \ No newline at end of file diff --git a/robot/resources/lib/payment_neogo.py b/robot/resources/lib/payment_neogo.py index 92efb8ef..2de451ea 100644 --- a/robot/resources/lib/payment_neogo.py +++ b/robot/resources/lib/payment_neogo.py @@ -15,6 +15,7 @@ import robot.errors from robot.libraries.BuiltIn import BuiltIn ROBOT_AUTO_KEYWORDS = False +NEOFS_CONTRACT = "5f490fbd8010fd716754073ee960067d28549b7d" if os.getenv('ROBOT_PROFILE') == 'selectel_smoke': from selectelcdn_smoke_vars import (NEOGO_CLI_PREFIX, NEO_MAINNET_ENDPOINT, @@ -24,8 +25,6 @@ else: NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT) -NEOFS_CONTRACT = "5f490fbd8010fd716754073ee960067d28549b7d" - @keyword('Init wallet') def init_wallet(): @@ -98,12 +97,12 @@ def dump_privkey(wallet: str, address: str): return out @keyword('Transfer Mainnet Gas') -def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int): - cmd = ( f"{NEOGO_CLI_PREFIX} wallet nep5 transfer -w {wallet} -r http://main_chain.neofs.devenv:30333 --from {address} " - f"--to {address_to} --token gas --amount {amount}" ) +def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int, wallet_pass:str=''): + cmd = ( f"{NEOGO_CLI_PREFIX} wallet nep5 transfer -w {wallet} -r {NEOFS_NEO_API_ENDPOINT} --from {address} " + f"--to {address_to} --token gas --amount {amount}" ) logger.info(f"Executing command: {cmd}") - out = _run_sh_with_passwd('', cmd) + out = _run_sh_with_passwd(wallet_pass, cmd) logger.info(f"Command completed with output: {out}") if not re.match(r'^(\w{64})$', out): @@ -113,7 +112,7 @@ def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int @keyword('Withdraw Mainnet Gas') def withdraw_mainnet_gas(wallet: str, address: str, scripthash: str, amount: int): - cmd = ( f"{NEOGO_CLI_PREFIX} contract invokefunction -w {wallet} -a {address} -r http://main_chain.neofs.devenv:30333 " + cmd = ( f"{NEOGO_CLI_PREFIX} contract invokefunction -w {wallet} -a {address} -r {NEOFS_NEO_API_ENDPOINT} " f"{NEOFS_CONTRACT} withdraw {scripthash} int:{amount} -- {scripthash}" ) logger.info(f"Executing command: {cmd}") diff --git a/robot/resources/lib/selectelcdn_smoke_vars.py b/robot/resources/lib/selectelcdn_smoke_vars.py index c27b8770..eb2e6998 100644 --- a/robot/resources/lib/selectelcdn_smoke_vars.py +++ b/robot/resources/lib/selectelcdn_smoke_vars.py @@ -7,4 +7,6 @@ NEO_MAINNET_ENDPOINT = "http://92.53.71.51:20332" # selectel main chain on lobachevsky-1 NEOFS_NEO_API_ENDPOINT = "http://92.53.71.51:20332" HTTP_GATE = 'http://92.53.71.51:38080' -S3_GATE = 'https://92.53.71.51:28080' \ No newline at end of file +S3_GATE = 'https://92.53.71.51:28080' +NEOFS_CONTRACT = "5f490fbd8010fd716754073ee960067d28549b7d" +NEOFS_NETMAP = ['92.53.71.51:18080', '92.53.71.52:18080','92.53.71.53:18080','92.53.71.54:18080', '92.53.71.55:18080'] \ No newline at end of file diff --git a/robot/testsuites/integration/acl_bearer.robot b/robot/testsuites/integration/acl_bearer.robot index 3c200fae..5cdf34b6 100644 --- a/robot/testsuites/integration/acl_bearer.robot +++ b/robot/testsuites/integration/acl_bearer.robot @@ -19,15 +19,25 @@ BearerToken Operations [Timeout] 20 min Generate Keys - Generate file Prepare eACL Role rules + + Log Check Bearer token with simple object + Generate file 1024 Check Container Inaccessible and Allow All Bearer Check eACL Deny and Allow All Bearer - Check eACL Deny and Allow All Bearer Filter OID Equal Check eACL Deny and Allow All Bearer Filter OID NotEqual + Check eACL Deny and Allow All Bearer Filter UserHeader Equal + + Log Check Bearer token with complex object + Cleanup Files ${FILE_S} + Generate file 20e+6 + Check Container Inaccessible and Allow All Bearer + Check eACL Deny and Allow All Bearer + Check eACL Deny and Allow All Bearer Filter OID Equal + Check eACL Deny and Allow All Bearer Filter OID NotEqual Check eACL Deny and Allow All Bearer Filter UserHeader Equal [Teardown] Cleanup @@ -82,22 +92,23 @@ Payment Operations Create Container Public - Log Create Public Container - ${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x0FFFFFFF - [Return] ${PUBLIC_CID_GEN} + Log Create Public Container + ${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x0FFFFFFF + [Return] ${PUBLIC_CID_GEN} Create Container Inaccessible - Log Create Inaccessible Container - ${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x40000000 + Log Create Inaccessible Container + ${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x40000000 [Return] ${PUBLIC_CID_GEN} Generate file - # Generate small file - ${FILE_S_GEN} = Generate file of bytes 1024 - Set Global Variable ${FILE_S} ${FILE_S_GEN} + [Arguments] ${SIZE} + + ${FILE_S_GEN} = Generate file of bytes ${SIZE} + Set Global Variable ${FILE_S} ${FILE_S_GEN} Prepare eACL Role rules @@ -215,14 +226,13 @@ Check eACL Deny and Allow All Bearer Filter OID Equal Run Keyword And Expect Error * ... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl - # Preiodical issue: https://github.com/nspcc-dev/neofs-node/issues/225 Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 - # https://github.com/nspcc-dev/neofs-node/issues/215 - # Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user - # Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user - + Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + Delete object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + Run Keyword And Expect Error * + ... Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user @@ -275,10 +285,10 @@ Check eACL Deny and Allow All Bearer Filter OID NotEqual Run Keyword And Expect Error * ... Head object ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user - # https://github.com/nspcc-dev/neofs-node/issues/215 - # Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user - # Run Keyword And Expect Error * - # ... Delete object ${USER_KEY} ${CID} ${D_OID_USER_2} bearer_allow_all_user + Delete object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + + Run Keyword And Expect Error * + ... Delete object ${USER_KEY} ${CID} ${D_OID_USER_2} bearer_allow_all_user @@ -319,21 +329,27 @@ Check eACL Deny and Allow All Bearer Filter UserHeader Equal Run Keyword And Expect Error * ... Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} bearer_allow_all_user ${FILE_OTH_HEADER} + + Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl Run Keyword And Expect Error * ... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl - # Preiodical issue: https://github.com/nspcc-dev/neofs-node/issues/225 - Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl - Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 + Run Keyword And Expect Error * + ... Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 - # https://github.com/nspcc-dev/neofs-node/issues/215 - # Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user - # Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user + Run Keyword And Expect Error * + ... Get Range Hash ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user 0:256 + + Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + Run Keyword And Expect Error * + ... Head object ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user + + Delete object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + Run Keyword And Expect Error * + ... Delete object ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user + # Check eACL Deny and Allow All Bearer Filter UserHeader NotEqual -# Check eACL Deny and Allow All Bearer for big object -# Check eACL Deny and Allow All Bearer Filter UserHeader Equal for big object - Cleanup diff --git a/robot/testsuites/integration/acl_extended.robot b/robot/testsuites/integration/acl_extended.robot index 110ca851..0d891978 100644 --- a/robot/testsuites/integration/acl_extended.robot +++ b/robot/testsuites/integration/acl_extended.robot @@ -17,9 +17,17 @@ Extended ACL Operations [Timeout] 20 min Generate Keys - Generate file Prepare eACL Role rules - + + Log Check extended ACL with simple object + Generate files 1024 + Check Actions + Check Filters + + Cleanup Files ${FILE_S} ${FILE_S_2} + + Log Check extended ACL with complex object + Generate files 20e+6 Check Actions Check Filters @@ -151,9 +159,10 @@ Create Container Public [Return] ${PUBLIC_CID_GEN} -Generate file - ${FILE_S_GEN_1} = Generate file of bytes 1024 - ${FILE_S_GEN_2} = Generate file of bytes 2048 +Generate files + [Arguments] ${SIZE} + ${FILE_S_GEN_1} = Generate file of bytes ${SIZE} + ${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} @@ -205,6 +214,9 @@ Check eACL Deny and Allow All System Get Range ${SYSTEM_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Get Range ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Get Range Hash ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Delete object ${SYSTEM_KEY} ${CID} ${D_OID_USER_S} ${EMPTY} Delete object ${SYSTEM_KEY_SN} ${CID} ${D_OID_USER_SN} ${EMPTY} @@ -231,15 +243,22 @@ Check eACL Deny and Allow All System Run Keyword And Expect Error * - ... Head object ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} + ... Head object ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} Run Keyword And Expect Error * - ... Head object ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} ${EMPTY} + ... Head object ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} ${EMPTY} Run Keyword And Expect Error * - ... Get Range ${SYSTEM_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + ... Get Range ${SYSTEM_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Run Keyword And Expect Error * - ... Get Range ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + ... Get Range ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + + Run Keyword And Expect Error * + ... Get Range Hash ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Run Keyword And Expect Error * + ... Get Range Hash ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + + Run Keyword And Expect Error * ... Delete object ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} Run Keyword And Expect Error * @@ -268,8 +287,11 @@ Check eACL Deny and Allow All System Get Range ${SYSTEM_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Get Range ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${SYSTEM_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Get Range Hash ${SYSTEM_KEY_SN} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Delete object ${SYSTEM_KEY} ${CID} ${D_OID_USER_S} ${EMPTY} - Delete object ${SYSTEM_KEY_SN} ${CID} ${D_OID_USER_SN} ${EMPTY} + Delete object ${SYSTEM_KEY_SN} ${CID} ${D_OID_USER_SN} ${EMPTY} @@ -285,6 +307,7 @@ Check eACL Deny All Other and Allow All Pubkey Search object ${EACL_KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H} Head object ${EACL_KEY} ${CID} ${S_OID_USER} ${EMPTY} Get Range ${EACL_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${EACL_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 Delete object ${EACL_KEY} ${CID} ${D_OID_USER} ${EMPTY} Set eACL ${USER_KEY} ${CID} ${EACL_ALLOW_ALL_Pubkey} --await @@ -301,6 +324,8 @@ Check eACL Deny All Other and Allow All Pubkey Run Keyword And Expect Error * ... Get Range ${OTHER_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Run Keyword And Expect Error * + ... Get Range Hash ${OTHER_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Run Keyword And Expect Error * ... Delete object ${OTHER_KEY} ${CID} ${S_OID_USER} ${EMPTY} Put object to NeoFS ${EACL_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER} @@ -308,6 +333,7 @@ Check eACL Deny All Other and Allow All Pubkey Search object ${EACL_KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H} Head object ${EACL_KEY} ${CID} ${S_OID_USER} ${EMPTY} Get Range ${EACL_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${EACL_KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 Delete object ${EACL_KEY} ${CID} ${S_OID_USER} ${EMPTY} @@ -325,8 +351,8 @@ Check eACL Deny and Allow All Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H} Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} - Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 Delete object ${KEY} ${CID} ${D_OID_USER} ${EMPTY} Set eACL ${USER_KEY} ${CID} ${DENY_EACL} @@ -343,18 +369,19 @@ Check eACL Deny and Allow All Run Keyword And Expect Error * ... Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Run Keyword And Expect Error * + ... Get Range Hash ${KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Run Keyword And Expect Error * ... Delete object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} - Set eACL ${USER_KEY} ${CID} ${ALLOW_EACL} Sleep ${MORPH_BLOCK_TIMEOUT} - Put object to NeoFS ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER} Get object from NeoFS ${KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H} Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256 Delete object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} Cleanup diff --git a/robot/testsuites/integration/replication.robot b/robot/testsuites/integration/replication.robot index 45f92583..3378dc14 100644 --- a/robot/testsuites/integration/replication.robot +++ b/robot/testsuites/integration/replication.robot @@ -27,9 +27,6 @@ NeoFS Object Replication Wait Until Keyword Succeeds 1 min 15 sec ... Transaction accepted in block ${TX_DEPOSIT} Get Transaction ${TX_DEPOSIT} - - Sleep 1 min - ${CID} = Create container ${PRIV_KEY} ${EMPTY} REP 2 IN X CBF 1 SELECT 4 FROM * AS X Container Existing ${PRIV_KEY} ${CID} @@ -40,12 +37,23 @@ NeoFS Object Replication ${S_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID} ${EMPTY} ${EMPTY} Validate storage policy for object ${PRIV_KEY} 2 ${CID} ${S_OID} + @{NODES_OBJ} = Get nodes with object ${PRIV_KEY} ${CID} ${S_OID} @{NODES_OBJ_STOPPED} = Stop nodes 1 @{NODES_OBJ} + Sleep 1 min + Validate storage policy for object ${PRIV_KEY} 2 ${CID} ${S_OID} Start nodes @{NODES_OBJ_STOPPED} - [Teardown] Cleanup Files ${FILE} + [Teardown] Cleanup ${FILE} @{NODES_OBJ_STOPPED} + + +*** Keywords *** + +Cleanup + [Arguments] ${FILE} @{NODES_OBJ_STOPPED} + Start nodes @{NODES_OBJ_STOPPED} + Cleanup Files ${FILE} diff --git a/robot/testsuites/integration/s3_gate.robot b/robot/testsuites/integration/s3_gate.robot index bf77f417..ff2ae253 100644 --- a/robot/testsuites/integration/s3_gate.robot +++ b/robot/testsuites/integration/s3_gate.robot @@ -25,11 +25,11 @@ NeoFS S3 Gateway ... Transaction accepted in block ${TX_DEPOSIT} Get Transaction ${TX_DEPOSIT} - ${FILE_S3} = Generate file of bytes 256 + ${FILE_S3} = Generate file of bytes 20e+6 ${FILE_S3_HASH} = Get file hash ${FILE_S3} ${FILE_S3_NAME} = Get file name ${FILE_S3} - ${FILE_FS} = Generate file of bytes 256 + ${FILE_FS} = Generate file of bytes 20e+6 ${FILE_FS_HASH} = Get file hash ${FILE_FS} ${FILE_FS_NAME} = Get file name ${FILE_FS} @@ -86,5 +86,5 @@ NeoFS S3 Gateway List Should Not Contain Value ${LIST_S3_OBJECTS} FILE_S3_NAME [Teardown] Cleanup Files s3_obj_get_fs fs_obj_get_fs s3_obj_get_s3 fs_obj_get_s3 - ... ${FILE_S3} ${FILE_FS} hcs.pub.key + ... ${FILE_S3} ${FILE_FS} diff --git a/robot/testsuites/smoke/selectelcdn_smoke.robot b/robot/testsuites/smoke/selectelcdn_smoke.robot index 56424862..3d91de60 100644 --- a/robot/testsuites/smoke/selectelcdn_smoke.robot +++ b/robot/testsuites/smoke/selectelcdn_smoke.robot @@ -1,33 +1,93 @@ # -*- coding: robot -*- *** Settings *** -Variables ../../variables/common.py -Variables ../../variables/selectelcdn_smoke.py +Variables ../../variables/common.py -Library ${RESOURCES}/neofs.py -Library ${RESOURCES}/payment_neogo.py -Library ${RESOURCES}/gates.py +Library Collections +Library ${RESOURCES}/neofs.py +Library ${RESOURCES}/payment_neogo.py +Library ${RESOURCES}/gates.py + + +*** Variables *** +# wallet that has assets in selectel mainnet +${WALLET_ROOT} = wallets/selectel_mainnet_wallet.json *** Test cases *** NeoFS Storage Smoke - [Documentation] Creates container and does PUT, GET and LIST on it via CLI and via HTTP Gate - [Timeout] 5 min + [Documentation] Creates container and does PUT, GET and LIST on it via CLI and via HTTP Gate + [Timeout] 5 min + + # user.key, container owner + ${PRIV_KEY} = Form WIF from String 1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb + + ${WALLET} = Init wallet + + Generate wallet from WIF ${WALLET} ${PRIV_KEY} + ${ADDR} = Dump Address ${WALLET} + Dump PrivKey ${WALLET} ${ADDR} + ${SCRIPT_HASH} = Get ScripHash ${PRIV_KEY} - ${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 50 one - Wait Until Keyword Succeeds 1 min 15 sec - ... Transaction accepted in block ${TX_DEPOSIT} - Get Transaction ${TX_DEPOSIT} - ${CID} = Create container ${PRIV_KEY} public - Wait Until Keyword Succeeds 2 min 30 sec - ... Container Existing ${PRIV_KEY} ${CID} + ${TX} = Transfer Mainnet Gas ${WALLET_ROOT} NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc ${ADDR} 2 one + Wait Until Keyword Succeeds 2 min 15 sec + ... Transaction accepted in block ${TX} + + Get Transaction ${TX} - ${FILE} = Generate file of bytes 1024 - ${S_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID} ${EMPTY} ${EMPTY} - Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} ${EMPTY} s_file_read - ${FILEPATH} = Get via HTTP Gate ${CID} ${S_OID} + ${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 1 + Wait Until Keyword Succeeds 1 min 15 sec + ... Transaction accepted in block ${TX_DEPOSIT} + Get Transaction ${TX_DEPOSIT} + Get Balance ${PRIV_KEY} + + ${CID} + ... ${BUCKET} + ... ${ACCESS_KEY_ID} + ... ${SEC_ACCESS_KEY} + ... ${OWNER_PRIV_KEY} = Init S3 Credentials ${PRIV_KEY} keys/s3_selectel_hcs.pub.key + + ${S3_CLIENT} = Config S3 client ${ACCESS_KEY_ID} ${SEC_ACCESS_KEY} + + + + ${CONTEINERS_LIST} = Container List ${PRIV_KEY} + List Should Contain Value ${CONTEINERS_LIST} ${CID} + + ${FILE_S3} = Generate file of bytes 1024 + ${FILE_S3_HASH} = Get file hash ${FILE_S3} + ${FILE_S3_NAME} = Get file name ${FILE_S3} + + ${FILE_FS} = Generate file of bytes 1024 + ${FILE_FS_HASH} = Get file hash ${FILE_FS} + ${FILE_FS_NAME} = Get file name ${FILE_FS} + + ${OID_FS} = Put object to NeoFS ${PRIV_KEY} ${FILE_FS} ${CID} ${EMPTY} ${EMPTY} + Put object S3 ${S3_CLIENT} ${BUCKET} ${FILE_S3} + + ${OID_LIST_S3} = Search object ${PRIV_KEY} ${CID} ${EMPTY} ${EMPTY} FileName=${FILE_S3_NAME} + ${OID_S3} = Get From List ${OID_LIST_S3} 0 + + Get object from NeoFS ${PRIV_KEY} ${CID} ${OID_FS} ${EMPTY} s_file_read + Get object S3 ${S3_CLIENT} ${BUCKET} ${FILE_FS_NAME} fs_obj_get_s3 + ${FILEPATH_FS} = Get via HTTP Gate ${CID} ${OID_FS} + + Verify file hash fs_obj_get_s3 ${FILE_FS_HASH} + Verify file hash s_file_read ${FILE_FS_HASH} + Verify file hash ${FILEPATH_FS} ${FILE_FS_HASH} + + Get object from NeoFS ${PRIV_KEY} ${CID} ${OID_S3} ${EMPTY} s_file_read + Get object S3 ${S3_CLIENT} ${BUCKET} ${FILE_S3_NAME} s3_obj_get_s3 + ${FILEPATH_S3} = Get via HTTP Gate ${CID} ${OID_S3} + + Verify file hash s3_obj_get_s3 ${FILE_S3_HASH} + Verify file hash s_file_read ${FILE_S3_HASH} + Verify file hash ${FILEPATH_S3} ${FILE_S3_HASH} + + [Teardown] Cleanup Files ${FILE_S3} ${FILE_FS} s_file_read s3_obj_get_s3 + ... fs_obj_get_s3 ${FILEPATH_S3} ${FILEPATH_FS} \ No newline at end of file diff --git a/robot/variables/common.py b/robot/variables/common.py index ee30c5d1..f6387928 100644 --- a/robot/variables/common.py +++ b/robot/variables/common.py @@ -9,9 +9,5 @@ CERT="%s/../../ca" % ROOT # in case when test is run from root in docker ABSOLUTE_FILE_PATH="/robot/testsuites/integration" -JF_TOKEN = os.getenv('JF_TOKEN') -REG_USR = os.getenv('REG_USR') -REG_PWD = os.getenv('REG_PWD') - MORPH_BLOCK_TIMEOUT = "10sec" NEOFS_EPOCH_TIMEOUT = "30sec" diff --git a/robot/variables/selectelcdn_smoke.py b/robot/variables/selectelcdn_smoke.py deleted file mode 100644 index 279142c6..00000000 --- a/robot/variables/selectelcdn_smoke.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python3 - -# wallet that has assets in selectel mainnet -WALLET = 'wallets/selectel_mainnet_wallet.json' -# address from this wallet anf its representations -ADDR = 'NbTiM6h8r99kpRtb428XcsUk1TzKed2gTc' -SCRIPT_HASH = 'eb88a496178256213f674eb302e44f9d85cf8aaa' -PRIV_KEY = 'KxyjQ8eUa4FHt3Gvioyt1Wz29cTUrE4eTqX3yFSk1YFCsPL8uNsY'