frostfs-testcases/robot/resources/lib/python_keywords/node_management.py

281 lines
9 KiB
Python
Raw Normal View History

#!/usr/bin/python3.9
"""
This module contains keywords for management test stand
nodes. It assumes that nodes are docker containers.
"""
import random
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
import re
from contextlib import contextmanager
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
from dataclasses import dataclass
from typing import Optional
from cli_helpers import _cmd_run
import docker
from common import (NEOFS_CLI_EXEC, NEOFS_NETMAP_DICT, STORAGE_CONTROL_ENDPOINT_PRIVATE,
STORAGE_NODE_BIN_PATH, STORAGE_NODE_SSH_PASSWORD,
STORAGE_NODE_SSH_PRIVATE_KEY_PATH, STORAGE_NODE_SSH_USER, WALLET_CONFIG)
from robot.api import logger
from robot.api.deco import keyword
from ssh_helper import HostClient
ROBOT_AUTO_KEYWORDS = False
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@dataclass
class HealthStatus:
network_status: str = None
health_status: str = None
@staticmethod
def from_stdout(output: str) -> 'HealthStatus':
network, health = None, None
for line in output.split('\n'):
if 'Network status' in line:
network = line.split(':')[-1].strip()
if 'Health status' in line:
health = line.split(':')[-1].strip()
return HealthStatus(network, health)
@contextmanager
def create_ssh_client(node_name: str) -> HostClient:
if node_name not in NEOFS_NETMAP_DICT:
raise AssertionError(f'Node {node_name} is not found!')
# We use rpc endpoint to determine host address, because control endpoint
# (if it is private) will be a local address on the host machine
node_config = NEOFS_NETMAP_DICT.get(node_name)
host = node_config.get('rpc').split(':')[0]
ssh_client = HostClient(
host,
login=STORAGE_NODE_SSH_USER,
password=STORAGE_NODE_SSH_PASSWORD,
private_key_path=STORAGE_NODE_SSH_PRIVATE_KEY_PATH,
)
try:
yield ssh_client
finally:
ssh_client.drop()
@keyword('Stop Nodes')
def stop_nodes(number: int, nodes: list) -> list:
"""
The function shuts down the given number of randomly
selected nodes in docker.
Args:
number (int): the number of nodes to shut down
nodes (list): the list of nodes for possible shut down
Returns:
(list): the list of nodes which have been shut down
"""
nodes = random.sample(nodes, number)
client = docker.APIClient()
for node in nodes:
node = node.split('.')[0]
client.stop(node)
return nodes
@keyword('Start Nodes')
def start_nodes(nodes: list) -> None:
"""
The function raises the given nodes.
Args:
nodes (list): the list of nodes to raise
Returns:
(void)
"""
client = docker.APIClient()
for node in nodes:
node = node.split('.')[0]
client.start(node)
@keyword('Get control endpoint and wallet')
def get_control_endpoint_and_wallet(endpoint_number: str = ''):
"""
Gets control endpoint for a random or given node
Args:
endpoint_number (optional, str): the number of the node
in the form of 's01', 's02', etc.
given in NEOFS_NETMAP_DICT as keys
Returns:
(str): the number of the node
(str): endpoint control for the node
(str): the wallet of the respective node
"""
if endpoint_number == '':
endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys()))
logger.info(f'Random node chosen: {endpoint_num}')
else:
endpoint_num = endpoint_number
endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}']
endpoint_control = endpoint_values['control']
wallet = endpoint_values['wallet_path']
return endpoint_num, endpoint_control, wallet
@keyword('Get Locode')
def get_locode():
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values()))
locode = endpoint_values['UN-LOCODE']
logger.info(f'Random locode chosen: {locode}')
return locode
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Stop Nodes Remote')
def stop_nodes_remote(number: int, nodes: list) -> list:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function shuts down the given number of randomly
selected nodes in docker.
Args:
number (int): the number of nodes to shut down
nodes (list): the list of nodes for possible shut down
Returns:
(list): the list of nodes which have been shut down
"""
nodes = random.sample(nodes, number)
for node in nodes:
node = node.split('.')[0]
with create_ssh_client(node) as ssh_client:
ssh_client.exec(f'docker stop {node}')
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
return nodes
@keyword('Start Nodes Remote')
def start_nodes_remote(nodes: list) -> None:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function starts nodes in docker.
Args:
nodes (list): the list of nodes for possible shut down
"""
for node in nodes:
node = node.split('.')[0]
with create_ssh_client(node) as ssh_client:
ssh_client.exec(f'docker start {node}')
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Healthcheck for node')
def node_healthcheck(node_name: str) -> HealthStatus:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function returns node's health status.
Args:
node_name str: node name to use for netmap snapshot operation
Returns:
health status as HealthStatus object.
"""
command = "control healthcheck"
output = run_control_command(node_name, command)
return HealthStatus.from_stdout(output)
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Set status for node')
def node_set_status(node_name: str, status: str) -> None:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function sets particular status for given node.
Args:
node_name str: node name to use for netmap snapshot operation
status str: online or offline.
Returns:
(void)
"""
command = f"control set-status --status {status}"
run_control_command(node_name, command)
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Get netmap snapshot')
def get_netmap_snapshot(node_name: Optional[str] = None) -> str:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function returns string representation of netmap-snapshot.
Args:
node_name str: node name to use for netmap snapshot operation
Returns:
string representation of netmap-snapshot
"""
node_name = node_name or list(NEOFS_NETMAP_DICT)[0]
command = "control netmap-snapshot"
return run_control_command(node_name, command)
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Shard list for node')
def node_shard_list(node_name: str) -> list[str]:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function returns list of shards for particular node.
Args:
node_name str: node name to use for netmap snapshot operation
Returns:
list of shards.
"""
command = "control shards list"
output = run_control_command(node_name, command)
return re.findall(r'Shard (.*):', output)
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Shard list for node')
def node_shard_set_mode(node_name: str, shard: str, mode: str) -> str:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function sets mode for node's particular shard.
Args:
node_name str: node name to use for netmap snapshot operation
Returns:
health status as HealthStatus object.
"""
command = f"control shards set-mode --id {shard} --mode {mode}"
return run_control_command(node_name, command)
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
@keyword('Drop object from node {node_name}')
def drop_object(node_name: str, cid: str, oid: str) -> str:
Add test suites for acl, container and node management Signed-off-by: Vladimir Domnich <v.domnich@yadro.com> commit f7c68cfb423e3213179521954dccb6053fc6382d Merge: e234b61 99bfe6b Merge branch 'avolkov/add_ssh' into internal_tmp_b commit 99bfe6b56cd75590f868313910068cf1a80bd43f Tick one more epoch. commit bd70bc49391d578cdda727edb4dcd181b832bf1e Start nodes in case of test fail. commit b3888ec62cfc3c18b1dff58962a94a3094342186 Catch json decode error. commit c18e415b783ec3e4ce804f43c19246240c186a97 Add ssh-key access. commit 7dbdeb653b7d5b7ab3874b546e05a48b502c2460 Add some tests. commit 844367c68638c7f97ba4860dd0069c07f499d66d Add some tests for nodes management. commit 1b84b37048dcd3cc0888aa54639975fc11fb2d75 Add some tests for nodes management. commit b30c1336a6919e0c8e500bdf2a9be3d5a14470ea Add ssh execution option. commit 2df40eca74ee20bd668778715185ffddda63cb05 Change AWS cli v1 to cli v2. commit 7403da3d7c2a5963cfbb12b7c0f3d1d641f52a7e Change AWS cli v1 to cli v2. commit b110dcdb655a585e6c53e6ebc3eae7bf1f1e792f Change AWS cli v1 to cli v2. commit 6183756a4c064c932ee193c2e08a79343017fa49 Change AWS cli v1 to cli v2. commit 398006544d60896faa3fc6e6a9dbb51ada06759c Fix container run. commit e7202136dabbe7e2d3da508e0a2ec55a0d5cb67a Added tests with AWS CLI. commit 042e1478ee1fd700c8572cbc6d0d9e6b312b8e8d Fix PR comments. commit e234b61dbb9b8b10812e069322ab03615af0d44e Add debug for env. commit 14febd06713dc03a8207bb80384acb4a7d32df0e Move env variables for pytest docker into env file. commit bafdc6131b5ac855a43b672be194cde2ccf6f75b Move env variables for pytest docker into env file. commit 27c2c6b11f51d2e3c085d44b814cb4c00f81b376 Move env variables for pytest docker into env file. commit e4db4948978e092adb83aeacdf06619f5ca2f242 Merge branch 'master' into avolkov/try_pytest commit c83a7e625e8daba3a40b65a1d69b2b1323e9ae28 WIP. commit 42489bbf8058acd2926cdb04074dc9a8ff86a0a0 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit 62526d94dc2bf72372125bea119fa66f670cf7e1 Improve allure attachments. commit 4564dae697cb069ac45bc4ba7eb0b5bbdcf1d153 Merge branch 'avolkov/try_pytest' into internal_tmp_b commit ab65810b23410ca7382ed4bdd257addfa6619659 Added tests for S3 API. commit 846c495a846c977f3e5f0bada01e5a9691a81e3d Let's get NEOFS_IR_CONTRACTS_NEOFS from env. commit c39bd88568b70ffcb76b76d68531b17d3747829d Added S3 test for versioning. commit d7c9f351abc7e02d4ebf162475604a2d6b46e712 Merge remote-tracking branch 'origin/avolkov/try_pytest' into internal_tmp_b commit bfbed22a50ce4cb6a49de383cfef66452ba9f4c1 Added some tests for S3 API and curl tests for HTTP. commit 1c49def3ddd0b3f7cf97f131e269ad465c70a680 Add yadro submodule commit 2a91685f9108101ab523e05cc9287d0f5a20196b Fix. commit 33fc2813e205766e69ef74a42a10850db6c63ce6 Add debug. commit aaaceca59e4c67253ecd4a741667b7327d1fb679 Add env variables for data nodes. commit 001cb26bcc22c8543fb2672564e898928d20622b Merge: b48a87d c70da26 Merge branch 'avolkov/try_pytest' into tmp_b commit b48a87d9a09309fea671573ba6cf303c31b11b6a Added submodule commit c70da265d319950977774e34740276f324eb57a7 Added tests for S3 bucket API. commit 3d335abe6de45d1859454f1ddf85a97514667b8f Added tests for S3 object API. commit 2ac829c700f5bc20c28953f1d40cd953fed8b390 flake8 changes for python_keywords module. commit 2de5963e96b13a5e944906b695e5d9c0829de9ad Add pytest tests. commit 4472c079b9dfd979b7c101bea32893c80cb1fe57 Add pytest tests. Signed-off-by: a.y.volkov <a.y.volkov@yadro.com>
2022-07-08 17:24:55 +00:00
"""
The function drops object from particular node.
Args:
node_name str: node name to use for netmap snapshot operation
Returns:
health status as HealthStatus object.
"""
command = f"control drop-objects -o {cid}/{oid}"
return run_control_command(node_name, command)
def run_control_command(node_name: str, command: str) -> str:
control_endpoint = NEOFS_NETMAP_DICT[node_name]["control"]
wallet_path = NEOFS_NETMAP_DICT[node_name]["wallet_path"]
if not STORAGE_CONTROL_ENDPOINT_PRIVATE:
cmd = (
f'{NEOFS_CLI_EXEC} {command} --rpc-endpoint {control_endpoint} '
f'--wallet {wallet_path} --config {WALLET_CONFIG}'
)
output = _cmd_run(cmd)
return output
# Private control endpoint is accessible only from the host where storage node is running
# So, we connect to storage node host and run CLI command from there
with create_ssh_client(node_name) as ssh_client:
# Copy wallet content on storage node host
with open(wallet_path, "r") as file:
wallet = file.read()
remote_wallet_path = "/tmp/{node_name}-wallet.json"
ssh_client.exec_with_confirmation(f"echo '{wallet}' > {remote_wallet_path}", [""])
# Put config on storage node host
remote_config_path = "/tmp/{node_name}-config.yaml"
remote_config = 'password: ""'
ssh_client.exec_with_confirmation(f"echo '{remote_config}' > {remote_config_path}", [""])
# Execute command
cmd = (
f'{STORAGE_NODE_BIN_PATH}/neofs-cli {command} --endpoint {control_endpoint} '
f'--wallet {remote_wallet_path} --config {remote_config_path}'
)
output = ssh_client.exec_with_confirmation(cmd, [""])
return output.stdout