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 <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-07-11 14:58:40 +04:00
parent be39480ade
commit 014a1fee95
4 changed files with 31 additions and 22 deletions

View file

@ -7,9 +7,14 @@ SHELL = bash
OUTPUT_DIR = artifacts/ OUTPUT_DIR = artifacts/
KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git
VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a) VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a)
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:6 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) 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 endif

View file

@ -25,7 +25,7 @@ class TestACL:
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def create_two_wallets(self, prepare_wallet_and_deposit): def create_two_wallets(self, prepare_wallet_and_deposit):
self.main_wallet = 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') @allure.title('Test basic ACL')
def test_basic_acl(self): def test_basic_acl(self):

View file

@ -104,7 +104,7 @@ def get_container(wallet: str, cid: str, flag: str = '--json') -> dict:
""" """
cmd = ( cmd = (
f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' 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) output = _cmd_run(cmd)
if flag != '--json': if flag != '--json':

View file

@ -29,44 +29,49 @@ GAS_HASH = '0xd2a4cff31913016155e38e474a2c06d08be276cf'
NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS") NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS")
ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/") ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/")
DEVENV_PATH = os.getenv("DEVENV_PATH", "../neofs-dev-env")
MORPH_MAGIC = os.getenv("MORPH_MAGIC") 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_CONTROL_ENDPOINT_1 = os.getenv("STORAGE_CONTROL_ENDPOINT_1", "s01.neofs.devenv:8081")
STORAGE_RPC_ENDPOINT_2 = os.getenv('STORAGE_RPC_ENDPOINT_2', os.getenv('DATA_NODE_2', 's02.neofs.devenv:8080')) STORAGE_CONTROL_ENDPOINT_2 = os.getenv("STORAGE_CONTROL_ENDPOINT_2", "s02.neofs.devenv:8081")
STORAGE_RPC_ENDPOINT_3 = os.getenv('STORAGE_RPC_ENDPOINT_3', os.getenv('DATA_NODE_3', 's03.neofs.devenv:8080')) STORAGE_CONTROL_ENDPOINT_3 = os.getenv("STORAGE_CONTROL_ENDPOINT_3", "s03.neofs.devenv:8081")
STORAGE_RPC_ENDPOINT_4 = os.getenv('STORAGE_RPC_ENDPOINT_4', os.getenv('DATA_NODE_4', 's04.neofs.devenv:8080')) 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_WALLET_PATH_1 = os.getenv("STORAGE_WALLET_PATH_1", f"{DEVENV_PATH}/services/storage/wallet01.json")
STORAGE_CONTROL_ENDPOINT_2 = os.getenv('STORAGE_CONTROL_ENDPOINT_2', os.getenv('NEOFS_CONTROL_NODE_2', 's02.neofs.devenv:8081')) STORAGE_WALLET_PATH_2 = os.getenv("STORAGE_WALLET_PATH_2", f"{DEVENV_PATH}/services/storage/wallet02.json")
STORAGE_CONTROL_ENDPOINT_3 = os.getenv('STORAGE_CONTROL_ENDPOINT_3', os.getenv('NEOFS_CONTROL_NODE_3', 's03.neofs.devenv:8081')) STORAGE_WALLET_PATH_3 = os.getenv("STORAGE_WALLET_PATH_3", f"{DEVENV_PATH}/services/storage/wallet03.json")
STORAGE_CONTROL_ENDPOINT_4 = os.getenv('STORAGE_CONTROL_ENDPOINT_4', os.getenv('NEOFS_CONTROL_NODE_4', 's04.neofs.devenv:8081')) 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 = { NEOFS_NETMAP_DICT = {
's01': { 's01': {
'rpc': STORAGE_RPC_ENDPOINT_1, 'rpc': STORAGE_RPC_ENDPOINT_1,
'control': STORAGE_CONTROL_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' 'UN-LOCODE': 'RU MOW'
}, },
's02': { 's02': {
'rpc': STORAGE_RPC_ENDPOINT_2, 'rpc': STORAGE_RPC_ENDPOINT_2,
'control': STORAGE_CONTROL_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' 'UN-LOCODE': 'RU LED'
}, },
's03': { 's03': {
'rpc': STORAGE_RPC_ENDPOINT_3, 'rpc': STORAGE_RPC_ENDPOINT_3,
'control': STORAGE_CONTROL_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' 'UN-LOCODE': 'SE STO'
}, },
's04': { 's04': {
'rpc': STORAGE_RPC_ENDPOINT_4, 'rpc': STORAGE_RPC_ENDPOINT_4,
'control': STORAGE_CONTROL_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' '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') NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/empty_passwd.yml" 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_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml"
MAINNET_SINGLE_ADDR = 'NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP' MAINNET_SINGLE_ADDR = 'NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP'
MAINNET_WALLET_PASS = 'one' 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_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" S3_GATE_WALLET_PATH = f"{DEVENV_PATH}/services/s3_gate/wallet.json"
S3_GATE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/s3_gate/wallet.json"
S3_GATE_WALLET_PASS = 's3' S3_GATE_WALLET_PASS = 's3'
STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root') STORAGE_NODE_USER = os.getenv('STORAGE_NODE_USER', 'root')