From 014a1fee95946daeb2cc7c2a8f016a3ee7650b19 Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Mon, 11 Jul 2022 14:58:40 +0400 Subject: [PATCH] Enable configuration of wallets directories Add new variables to common.py that allow: - Make paths to wallets configurable. - Make devenv services path configurable. Signed-off-by: Vladimir Domnich --- Makefile | 11 ++++-- pytest_tests/testsuites/acl/test_acl.py | 2 +- .../lib/python_keywords/container.py | 2 +- robot/variables/common.py | 38 ++++++++++--------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 9d9ea410..0119af04 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,16 @@ SHELL = bash OUTPUT_DIR = artifacts/ KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a) -ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:6 +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:6 + +ifdef DEVENV_SERVICES_PATH + RUN_OPTIONS += -v $(DEVENV_SERVICES_PATH)/chain/node-wallet.json:/wallets/mainnet.json -e MAINNET_WALLET_PATH_HOST="/wallets/mainnet.json" + RUN_OPTIONS += -v $(DEVENV_SERVICES_PATH)/ir/wallet01.json:/wallets/ir.json -e IR_WALLET_PATH="/wallets/ir.json" +endif ifeq ($(shell uname -s),Darwin) - DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636 + DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636 endif diff --git a/pytest_tests/testsuites/acl/test_acl.py b/pytest_tests/testsuites/acl/test_acl.py index fa3abe8b..02bad4ef 100644 --- a/pytest_tests/testsuites/acl/test_acl.py +++ b/pytest_tests/testsuites/acl/test_acl.py @@ -25,7 +25,7 @@ class TestACL: @pytest.fixture(autouse=True) def create_two_wallets(self, prepare_wallet_and_deposit): self.main_wallet = prepare_wallet_and_deposit - self.other_wallet = wallet.init_wallet(ASSETS_DIR) + self.other_wallet = wallet.init_wallet(ASSETS_DIR)[0] # We need wallet file path only @allure.title('Test basic ACL') def test_basic_acl(self): diff --git a/robot/resources/lib/python_keywords/container.py b/robot/resources/lib/python_keywords/container.py index 0e5da3ae..5d53a318 100644 --- a/robot/resources/lib/python_keywords/container.py +++ b/robot/resources/lib/python_keywords/container.py @@ -104,7 +104,7 @@ def get_container(wallet: str, cid: str, flag: str = '--json') -> dict: """ cmd = ( f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'--config {WALLET_CONFIG} --cid {cid} container get --json' + f'--config {WALLET_CONFIG} --cid {cid} container get {flag}' ) output = _cmd_run(cmd) if flag != '--json': diff --git a/robot/variables/common.py b/robot/variables/common.py index 31183306..77977967 100644 --- a/robot/variables/common.py +++ b/robot/variables/common.py @@ -29,44 +29,49 @@ GAS_HASH = '0xd2a4cff31913016155e38e474a2c06d08be276cf' NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS") ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/") +DEVENV_PATH = os.getenv("DEVENV_PATH", "../neofs-dev-env") MORPH_MAGIC = os.getenv("MORPH_MAGIC") -DEVENV_SERVICES_PATH = f"{os.getenv('DEVENV_PATH')}/services" +STORAGE_RPC_ENDPOINT_1 = os.getenv("STORAGE_RPC_ENDPOINT_1", "s01.neofs.devenv:8080") +STORAGE_RPC_ENDPOINT_2 = os.getenv("STORAGE_RPC_ENDPOINT_2", "s02.neofs.devenv:8080") +STORAGE_RPC_ENDPOINT_3 = os.getenv("STORAGE_RPC_ENDPOINT_3", "s03.neofs.devenv:8080") +STORAGE_RPC_ENDPOINT_4 = os.getenv("STORAGE_RPC_ENDPOINT_4", "s04.neofs.devenv:8080") -STORAGE_RPC_ENDPOINT_1 = os.getenv('STORAGE_RPC_ENDPOINT_1', os.getenv('DATA_NODE_1', 's01.neofs.devenv:8080')) -STORAGE_RPC_ENDPOINT_2 = os.getenv('STORAGE_RPC_ENDPOINT_2', os.getenv('DATA_NODE_2', 's02.neofs.devenv:8080')) -STORAGE_RPC_ENDPOINT_3 = os.getenv('STORAGE_RPC_ENDPOINT_3', os.getenv('DATA_NODE_3', 's03.neofs.devenv:8080')) -STORAGE_RPC_ENDPOINT_4 = os.getenv('STORAGE_RPC_ENDPOINT_4', os.getenv('DATA_NODE_4', 's04.neofs.devenv:8080')) +STORAGE_CONTROL_ENDPOINT_1 = os.getenv("STORAGE_CONTROL_ENDPOINT_1", "s01.neofs.devenv:8081") +STORAGE_CONTROL_ENDPOINT_2 = os.getenv("STORAGE_CONTROL_ENDPOINT_2", "s02.neofs.devenv:8081") +STORAGE_CONTROL_ENDPOINT_3 = os.getenv("STORAGE_CONTROL_ENDPOINT_3", "s03.neofs.devenv:8081") +STORAGE_CONTROL_ENDPOINT_4 = os.getenv("STORAGE_CONTROL_ENDPOINT_4", "s04.neofs.devenv:8081") -STORAGE_CONTROL_ENDPOINT_1 = os.getenv('STORAGE_CONTROL_ENDPOINT_1', os.getenv('NEOFS_CONTROL_NODE_1', 's01.neofs.devenv:8081')) -STORAGE_CONTROL_ENDPOINT_2 = os.getenv('STORAGE_CONTROL_ENDPOINT_2', os.getenv('NEOFS_CONTROL_NODE_2', 's02.neofs.devenv:8081')) -STORAGE_CONTROL_ENDPOINT_3 = os.getenv('STORAGE_CONTROL_ENDPOINT_3', os.getenv('NEOFS_CONTROL_NODE_3', 's03.neofs.devenv:8081')) -STORAGE_CONTROL_ENDPOINT_4 = os.getenv('STORAGE_CONTROL_ENDPOINT_4', os.getenv('NEOFS_CONTROL_NODE_4', 's04.neofs.devenv:8081')) +STORAGE_WALLET_PATH_1 = os.getenv("STORAGE_WALLET_PATH_1", f"{DEVENV_PATH}/services/storage/wallet01.json") +STORAGE_WALLET_PATH_2 = os.getenv("STORAGE_WALLET_PATH_2", f"{DEVENV_PATH}/services/storage/wallet02.json") +STORAGE_WALLET_PATH_3 = os.getenv("STORAGE_WALLET_PATH_3", f"{DEVENV_PATH}/services/storage/wallet03.json") +STORAGE_WALLET_PATH_4 = os.getenv("STORAGE_WALLET_PATH_4", f"{DEVENV_PATH}/services/storage/wallet04.json") +STORAGE_WALLET_PATH = STORAGE_WALLET_PATH_1 NEOFS_NETMAP_DICT = { 's01': { 'rpc': STORAGE_RPC_ENDPOINT_1, 'control': STORAGE_CONTROL_ENDPOINT_1, - 'wallet_path':f"{DEVENV_SERVICES_PATH}/storage/wallet01.json", + 'wallet_path': STORAGE_WALLET_PATH_1, 'UN-LOCODE': 'RU MOW' }, 's02': { 'rpc': STORAGE_RPC_ENDPOINT_2, 'control': STORAGE_CONTROL_ENDPOINT_2, - 'wallet_path': f"{DEVENV_SERVICES_PATH}/storage/wallet02.json", + 'wallet_path': STORAGE_WALLET_PATH_2, 'UN-LOCODE': 'RU LED' }, 's03': { 'rpc': STORAGE_RPC_ENDPOINT_3, 'control': STORAGE_CONTROL_ENDPOINT_3, - 'wallet_path': f"{DEVENV_SERVICES_PATH}/storage/wallet03.json", + 'wallet_path': STORAGE_WALLET_PATH_3, 'UN-LOCODE': 'SE STO' }, 's04': { 'rpc': STORAGE_RPC_ENDPOINT_4, 'control': STORAGE_CONTROL_ENDPOINT_4, - 'wallet_path': f"{DEVENV_SERVICES_PATH}/storage/wallet04.json", + 'wallet_path': STORAGE_WALLET_PATH_4, 'UN-LOCODE': 'FI HEL' }, } @@ -75,15 +80,14 @@ NEOGO_EXECUTABLE = os.getenv('NEOGO_EXECUTABLE', 'neo-go') NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli') WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/empty_passwd.yml" -MAINNET_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/chain/node-wallet.json" +MAINNET_WALLET_PATH = os.getenv("MAINNET_WALLET_PATH", f"{DEVENV_PATH}/services/chain/node-wallet.json") MAINNET_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml" MAINNET_SINGLE_ADDR = 'NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP' MAINNET_WALLET_PASS = 'one' -IR_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/ir/wallet01.json" +IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", f"{DEVENV_PATH}/services/ir/wallet01.json") IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml" IR_WALLET_PASS = 'one' -STORAGE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/storage/wallet01.json" -S3_GATE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/s3_gate/wallet.json" +S3_GATE_WALLET_PATH = f"{DEVENV_PATH}/services/s3_gate/wallet.json" S3_GATE_WALLET_PASS = 's3' STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root')