forked from TrueCloudLab/frostfs-testcases
Update variables for node management tests:
1. To configure path of CLI binaries and config file on storage node. 2. Change prefix from CONTROL_NODE to STORAGE_NODE.
This commit is contained in:
parent
7eb7655b10
commit
73036200d8
2 changed files with 26 additions and 47 deletions
|
@ -8,10 +8,10 @@
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List, Tuple
|
from typing import List
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
from common import DEPLOY_PATH, NEOFS_NETMAP_DICT
|
from common import NEOFS_NETMAP_DICT, STORAGE_NODE_BIN_PATH, STORAGE_NODE_CONFIG_PATH
|
||||||
from robot.api import logger
|
from robot.api import logger
|
||||||
from robot.api.deco import keyword
|
from robot.api.deco import keyword
|
||||||
from ssh_helper import HostClient
|
from ssh_helper import HostClient
|
||||||
|
@ -152,10 +152,8 @@ def node_healthcheck(client: HostClient, node_name: str) -> HealthStatus:
|
||||||
|
|
||||||
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
control_url = node_config.get('control')
|
control_url = node_config.get('control')
|
||||||
host, port = control_url.split(':')
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control healthcheck --endpoint {control_url} ' \
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control healthcheck --endpoint {control_url} ' \
|
f'--config {STORAGE_NODE_CONFIG_PATH}'
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml'
|
|
||||||
output = client.exec_with_confirmation(cmd, [''])
|
output = client.exec_with_confirmation(cmd, [''])
|
||||||
return HealthStatus.from_stdout(output.stdout)
|
return HealthStatus.from_stdout(output.stdout)
|
||||||
|
|
||||||
|
@ -176,10 +174,8 @@ def node_set_status(client: HostClient, node_name: str, status: str):
|
||||||
|
|
||||||
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
control_url = node_config.get('control')
|
control_url = node_config.get('control')
|
||||||
host, port = control_url.split(':')
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control set-status --endpoint {control_url} ' \
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control set-status --endpoint {control_url} ' \
|
f'--config {STORAGE_NODE_CONFIG_PATH} --status {status}'
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml --status {status}'
|
|
||||||
client.exec_with_confirmation(cmd, [''])
|
client.exec_with_confirmation(cmd, [''])
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,10 +196,8 @@ def get_netmap_snapshot(client: HostClient, node_name: str = None) -> str:
|
||||||
|
|
||||||
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
control_url = node_config.get('control')
|
control_url = node_config.get('control')
|
||||||
host, port = control_url.split(':')
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control netmap-snapshot --endpoint {control_url} ' \
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control netmap-snapshot --endpoint {control_url} ' \
|
f'--config {STORAGE_NODE_CONFIG_PATH}'
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml'
|
|
||||||
output = client.exec_with_confirmation(cmd, [''])
|
output = client.exec_with_confirmation(cmd, [''])
|
||||||
return output.stdout
|
return output.stdout
|
||||||
|
|
||||||
|
@ -218,10 +212,10 @@ def node_shard_list(client: HostClient, node_name: str) -> List[str]:
|
||||||
Returns:
|
Returns:
|
||||||
list of shards.
|
list of shards.
|
||||||
"""
|
"""
|
||||||
control_url, port = _url_port_for_node(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control shards list --endpoint {control_url} ' \
|
control_url = node_config.get('control')
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control shards list --endpoint {control_url} ' \
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml'
|
f'--config {STORAGE_NODE_CONFIG_PATH}'
|
||||||
output = client.exec_with_confirmation(cmd, [''])
|
output = client.exec_with_confirmation(cmd, [''])
|
||||||
return re.findall(r'Shard (.*):', output.stdout)
|
return re.findall(r'Shard (.*):', output.stdout)
|
||||||
|
|
||||||
|
@ -236,10 +230,10 @@ def node_shard_set_mode(client: HostClient, node_name: str, shard: str, mode: st
|
||||||
Returns:
|
Returns:
|
||||||
health status as HealthStatus object.
|
health status as HealthStatus object.
|
||||||
"""
|
"""
|
||||||
control_url, port = _url_port_for_node(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control shards set-mode --endpoint {control_url} ' \
|
control_url = node_config.get('control')
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control shards set-mode --endpoint {control_url} ' \
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml --id {shard} --mode {mode}'
|
f'--config {STORAGE_NODE_CONFIG_PATH} --id {shard} --mode {mode}'
|
||||||
output = client.exec_with_confirmation(cmd, [''])
|
output = client.exec_with_confirmation(cmd, [''])
|
||||||
return output.stdout
|
return output.stdout
|
||||||
|
|
||||||
|
@ -254,27 +248,9 @@ def drop_object(client: HostClient, node_name: str, cid: str, oid: str) -> str:
|
||||||
Returns:
|
Returns:
|
||||||
health status as HealthStatus object.
|
health status as HealthStatus object.
|
||||||
"""
|
"""
|
||||||
control_url, port = _url_port_for_node(node_name)
|
|
||||||
cmd = f'{DEPLOY_PATH}/vendor/neofs-cli control drop-objects --endpoint {control_url} ' \
|
|
||||||
f'--wallet {DEPLOY_PATH}/services/storage/wallet0{port[-1]}.json ' \
|
|
||||||
f'--config {DEPLOY_PATH}/services/storage/cli-cfg.yml -o {cid}/{oid}'
|
|
||||||
output = client.exec_with_confirmation(cmd, [''])
|
|
||||||
return output.stdout
|
|
||||||
|
|
||||||
|
|
||||||
def _url_port_for_node(node_name: str) -> Tuple[str, str]:
|
|
||||||
"""
|
|
||||||
Returns control url and port for particular storage node.
|
|
||||||
Args:
|
|
||||||
node_name: str node bane from NEOFS_NETMAP_DICT
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
control url and port as a tuple.
|
|
||||||
"""
|
|
||||||
if node_name not in NEOFS_NETMAP_DICT:
|
|
||||||
raise AssertionError(f'Node {node_name} is not found!')
|
|
||||||
|
|
||||||
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
node_config = NEOFS_NETMAP_DICT.get(node_name)
|
||||||
control_url = node_config.get('control')
|
control_url = node_config.get('control')
|
||||||
port = control_url.split(':')[-1]
|
cmd = f'{STORAGE_NODE_BIN_PATH}/neofs-cli control drop-objects --endpoint {control_url} ' \
|
||||||
return control_url, port
|
f'--config {STORAGE_NODE_CONFIG_PATH} -o {cid}/{oid}'
|
||||||
|
output = client.exec_with_confirmation(cmd, [''])
|
||||||
|
return output.stdout
|
||||||
|
|
|
@ -75,8 +75,11 @@ IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml"
|
||||||
IR_WALLET_PASS = 'one'
|
IR_WALLET_PASS = 'one'
|
||||||
STORAGE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/storage/wallet01.json"
|
STORAGE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/storage/wallet01.json"
|
||||||
|
|
||||||
CONTROL_NODE_USER = os.getenv('CONTROL_NODE_USER', 'root')
|
WALLET_PASS = f"{os.getcwd()}/wallet_pass.yml"
|
||||||
CONTROL_NODE_PWD = os.getenv('CONTROL_NODE_PWD')
|
|
||||||
DEPLOY_PATH = os.getenv('DEPLOY_PATH', '/opt/dev-env')
|
STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root')
|
||||||
|
STORAGE_NODE_PWD = os.getenv('STORAGE_NODE_PWD')
|
||||||
|
STORAGE_NODE_BIN_PATH = os.getenv('STORAGE_NODE_BIN_PATH', '/opt/dev-env/vendor/neofs-cli')
|
||||||
|
STORAGE_NODE_CONFIG_PATH = os.getenv('STORAGE_NODE_CONFIG_PATH', '/opt/dev-env/services/storage/cli-cfg.yml')
|
||||||
|
|
||||||
FREE_STORAGE = os.getenv('FREE_STORAGE', "false").lower() == "true"
|
FREE_STORAGE = os.getenv('FREE_STORAGE', "false").lower() == "true"
|
||||||
|
|
Loading…
Reference in a new issue