[#341] Remove duplication of wallet passwords in configs

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-10-04 11:52:12 +04:00 committed by Vladimir
parent e8cbd286cd
commit 6b04663dee
6 changed files with 40 additions and 123 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@ TemporaryDir/*
artifacts/*
docs/*
venv.*/*
/*wallet_config.yml

View file

@ -1,80 +0,0 @@
---
# Object sizes
simple_obj_size: 1000
complex_obj_size: 2000
# Timeouts
container_wait_interval: '1m'
mainnet_block_time: '1s'
mainnet_timeout: '1min'
morph_block_time: '1s'
neofs_contract_cache_timeout: '30s'
shard_remove_interval: '1m'
# Services endpoints
neofs_endpoint: 's01.neofs.devenv:8080'
neo_mainnet_endpoint: 'http://main-chain.neofs.devenv:30333'
morph_endpoint: 'http://morph-chain.neofs.devenv:30333'
http_gate: 'http://http.neofs.devenv'
s3_gate: 'https://s3.neofs.devenv:8080'
storage_node_1: 's01.neofs.devenv:8080'
storage_node_2: 's02.neofs.devenv:8080'
storage_node_3: 's03.neofs.devenv:8080'
storage_node_4: 's04.neofs.devenv:8080'
neofs_netmap:
s01:
rpc: 's01.neofs.devenv:8080'
control: 's01.neofs.devenv:8081'
wallet_path: '../neofs-dev-env/services/storage/wallet01.json'
un_locode: 'RU MOW'
s02:
rpc: 's02.neofs.devenv:8080'
control: 's02.neofs.devenv:8081'
wallet_path: '../neofs-dev-env/services/storage/wallet02.json'
un_locode: 'RU LED'
s03:
rpc: 's03.neofs.devenv:8080'
control: 's03.neofs.devenv:8081'
wallet_path: '../neofs-dev-env/services/storage/wallet03.json'
un_locode: 'SE STO'
s04:
rpc: 's04.neofs.devenv:8080'
control: 's04.neofs.devenv:8081'
wallet_path: '../neofs-dev-env/services/storage/wallet04.json'
un_locode: 'FI HEL'
# Paths to binaries
neogo_executable: 'neo-go'
neofs_cli_exec: 'neofs-cli'
# Neo Blockchain configuration
gas_hash: '0xd2a4cff31913016155e38e474a2c06d08be276cf'
neofs_contract: 'd07ec2a43d2f8638934d340bfb60b6c23afce106'
morph_magic: '15405'
# NeoFS common parameters
common_placement_rule: "REP 2 IN X CBF 1 SELECT 4 FROM * AS X"
# TODO: remove within the scope of
# https://github.com/nspcc-dev/neofs-testcases/issues/246
gate_pub_key: '0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06bf'
# Wallets
devenv_services_path: '../neofs-dev-env/services'
wallet_config: 'neofs_cli_configs/empty_passwd.yml'
mainnet_wallet_path: '../neofs-dev-env/services/chain/node-wallet.json'
mainnet_wallet_config: 'neofs_cli_configs/one_wallet_password.yml'
mainnet_single_addr: 'NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP'
mainnet_wallet_pass: 'one'
ir_wallet_path: '../neofs-dev-env/services/ir/az.json'
ir_wallet_config: 'neofs_cli_configs/one_wallet_password.yml'
ir_wallet_pass: 'one'
storage_wallet_path: '../neofs-dev-env/services/storage/wallet01.json'

View file

@ -1 +0,0 @@
password: ""

View file

@ -1 +0,0 @@
password: "one"

View file

@ -1,9 +1,3 @@
#!/usr/bin/python3
"""
This module contains keywords for work with session token.
"""
import base64
import json
import logging
@ -13,14 +7,11 @@ import uuid
import allure
import json_transformers
from cli_helpers import _cmd_run, _run_with_passwd
from common import ASSETS_DIR, NEOFS_ENDPOINT, WALLET_CONFIG
from common import ASSETS_DIR, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, WALLET_CONFIG
from neo3 import wallet
logger = logging.getLogger("NeoLogger")
# path to neofs-cli executable
NEOFS_CLI_EXEC = os.getenv("NEOFS_CLI_EXEC", "neofs-cli")
@allure.step("Generate Session Token")
def generate_session_token(owner: str, session_wallet: str, cid: str = "") -> str:

View file

@ -1,7 +1,6 @@
import os
# Common NeoFS variables can be declared from neofs-dev-env env variables.
# High priority is accepted for those envs.
import yaml
CONTAINER_WAIT_INTERVAL = "1m"
@ -24,16 +23,19 @@ NEO_MAINNET_ENDPOINT = os.getenv("NEO_MAINNET_ENDPOINT", "http://main-chain.neof
MORPH_ENDPOINT = os.getenv("MORPH_ENDPOINT", "http://morph-chain.neofs.devenv:30333")
HTTP_GATE = os.getenv("HTTP_GATE", "http://http.neofs.devenv")
S3_GATE = os.getenv("S3_GATE", "https://s3.neofs.devenv:8080")
GAS_HASH = "0xd2a4cff31913016155e38e474a2c06d08be276cf"
GAS_HASH = os.getenv("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")
CLI_CONFIGS_PATH = os.getenv("CLI_CONFIGS_PATH", f"{os.getcwd()}/neofs_cli_configs")
DEVENV_PATH = os.getenv("DEVENV_PATH", os.path.join("..", "neofs-dev-env"))
MORPH_MAGIC = os.getenv("MORPH_MAGIC")
# Password of wallet owned by user on behalf of whom we are running tests
WALLET_PASS = os.getenv("WALLET_PASS", "")
# Configuration of storage nodes
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")
@ -43,25 +45,21 @@ STORAGE_CONTROL_ENDPOINT_1 = os.getenv("STORAGE_CONTROL_ENDPOINT_1", "s01.neofs.
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_PRIVATE = (
os.getenv("STORAGE_CONTROL_ENDPOINT_PRIVATE", "false").lower() == "true"
)
STORAGE_WALLET_PATH_1 = os.getenv(
"STORAGE_WALLET_PATH_1", f"{DEVENV_PATH}/services/storage/wallet01.json"
"STORAGE_WALLET_PATH_1", os.path.join(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_2", os.path.join(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_3", os.path.join(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_4", os.path.join(DEVENV_PATH, "services", "storage", "wallet04.json")
)
STORAGE_WALLET_PATH = STORAGE_WALLET_PATH_1
STORAGE_WALLET_PASS = os.getenv("STORAGE_WALLET_PASS", "")
STORAGE_WALLET_CONFIG = f"{CLI_CONFIGS_PATH}/empty_passwd.yml"
NEOFS_NETMAP_DICT = {
"s01": {
@ -89,30 +87,25 @@ NEOFS_NETMAP_DICT = {
"UN-LOCODE": "FI HEL",
},
}
NEOFS_NETMAP = [i["rpc"] for i in NEOFS_NETMAP_DICT.values()]
NEOFS_NETMAP = [node["rpc"] for node in NEOFS_NETMAP_DICT.values()]
# Paths to CLI executables
NEOGO_EXECUTABLE = os.getenv("NEOGO_EXECUTABLE", "neo-go")
NEOFS_CLI_EXEC = os.getenv("NEOFS_CLI_EXEC", "neofs-cli")
# Config of wallet with empty password. We use it for:
# - for wallet of user on behalf of whom we are running tests
# - for wallets of storage nodes
WALLET_CONFIG = f"{CLI_CONFIGS_PATH}/empty_passwd.yml"
NEOFS_AUTHMATE_EXEC = os.getenv("NEOFS_AUTHMATE_EXEC", "neofs-authmate")
NEOFS_ADM_EXEC = os.getenv("NEOFS_ADM_EXEC", "neofs-adm")
MAINNET_WALLET_PATH = os.getenv(
"MAINNET_WALLET_PATH", f"{DEVENV_PATH}/services/chain/node-wallet.json"
)
MAINNET_WALLET_CONFIG = os.getenv(
"MAINNET_WALLET_CONFIG", f"{CLI_CONFIGS_PATH}/one_wallet_password.yml"
"MAINNET_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "chain", "node-wallet.json")
)
MAINNET_SINGLE_ADDR = os.getenv("MAINNET_SINGLE_ADDR", "NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP")
MAINNET_WALLET_PASS = os.getenv("MAINNET_WALLET_PASS", "one")
IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", f"{DEVENV_PATH}/services/ir/az.json")
IR_WALLET_CONFIG = os.getenv("IR_WALLET_CONFIG", f"{CLI_CONFIGS_PATH}/one_wallet_password.yml")
IR_WALLET_PATH = os.getenv("IR_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "ir", "az.json"))
IR_WALLET_PASS = os.getenv("IR_WALLET_PASS", "one")
S3_GATE_WALLET_PATH = os.getenv(
"S3_GATE_WALLET_PATH", f"{DEVENV_PATH}/services/s3_gate/wallet.json"
"S3_GATE_WALLET_PATH", os.path.join(DEVENV_PATH, "services", "s3_gate", "wallet.json")
)
S3_GATE_WALLET_PASS = os.getenv("S3_GATE_WALLET_PASS", "s3")
@ -124,13 +117,27 @@ STORAGE_NODE_SSH_PRIVATE_KEY_PATH = os.getenv("STORAGE_NODE_SSH_PRIVATE_KEY_PATH
# Path to directory with CLI binaries on storage node (currently we need only neofs-cli)
STORAGE_NODE_BIN_PATH = os.getenv("STORAGE_NODE_BIN_PATH", f"{DEVENV_PATH}/vendor")
# Path to neofs-s3-authmate utility
NEOFS_AUTHMATE_EXEC = os.getenv("NEOFS_AUTHMATE_EXEC", "neofs-authmate")
# Path and config for neofs-adm utility. Optional if tests are running against devenv
NEOFS_ADM_EXEC = os.getenv("NEOFS_ADM_EXEC", "neofs-adm")
# Config for neofs-adm utility. Optional if tests are running against devenv
NEOFS_ADM_CONFIG_PATH = os.getenv("NEOFS_ADM_CONFIG_PATH")
INFRASTRUCTURE_TYPE = os.getenv("INFRASTRUCTURE_TYPE", "LOCAL_DEVENV")
FREE_STORAGE = os.getenv("FREE_STORAGE", "false").lower() == "true"
BIN_VERSIONS_FILE = os.getenv("BIN_VERSIONS_FILE")
# Generate wallet configs
# TODO: we should move all info about wallet configs to fixtures
WALLET_CONFIG = os.path.join(os.getcwd(), "wallet_config.yml")
with open(WALLET_CONFIG, "w") as file:
yaml.dump({"password": WALLET_PASS}, file)
STORAGE_WALLET_CONFIG = os.path.join(os.getcwd(), "storage_wallet_config.yml")
with open(STORAGE_WALLET_CONFIG, "w") as file:
yaml.dump({"password": STORAGE_WALLET_PASS}, file)
MAINNET_WALLET_CONFIG = os.path.join(os.getcwd(), "mainnet_wallet_config.yml")
with open(MAINNET_WALLET_CONFIG, "w") as file:
yaml.dump({"password": MAINNET_WALLET_PASS}, file)
IR_WALLET_CONFIG = os.path.join(os.getcwd(), "ir_wallet_config.yml")
with open(IR_WALLET_CONFIG, "w") as file:
yaml.dump({"password": IR_WALLET_PASS}, file)