Tick epoch using neofs-adm when running UAT.

This commit is contained in:
Vladimir Domnich 2022-07-14 09:58:46 +04:00
parent c257a01af1
commit 01aeacde09
5 changed files with 37 additions and 17 deletions

View file

@ -72,6 +72,9 @@ setup-for-remote-devenv:
echo STORAGE_WALLET_PATH_4="/.setup/services/storage/wallet04.json"
echo MAINNET_WALLET_PATH="/.setup/services/chain/node-wallet.json" >> $(CURDIR)/.env
echo IR_WALLET_PATH="/.setup/services/ir/wallet01.json" >> $(CURDIR)/.env
# env: files inside storage node to make calls via SSH on that node
echo STORAGE_NODE_BIN_PATH="$(DEV_ENV_DEPLOY_DIR)/vendor/neofs-cli" >> $(CURDIR)/.env
echo STORAGE_NODE_CONFIG_PATH="$(DEV_ENV_DEPLOY_DIR)/services/storage/cli-cfg.yml" >> $(CURDIR)/.env
ssh root@$(DEV_ENV_HOST_NAME) 'cd $(DEV_ENV_DEPLOY_DIR) && make env | grep NEOFS_IR_CONTRACTS_NEOFS' >> $(CURDIR)/.env
.PHONY: setup-for-sbercloud
@ -81,8 +84,7 @@ setup-for-sbercloud:
cp -r $(CONFIG_DIR)/alphabet-wallets $(SETUP_DIR)
cp $(CONFIG_DIR)/config.yaml $(SETUP_DIR)
cp -r $(CONFIG_DIR)/wallets $(SETUP_DIR)
# Generate .env file
# skipped IR_WALLET_PATH, NEOFS_IR_CONTRACTS_NEOFS, not sure whether NEO_MAINNET_ENDPOINT is correct
# Generate .env file (NEO_MAINNET_ENDPOINT might be incorrect)
echo NEO_MAINNET_ENDPOINT=http://$(NODE1):40333 > $(CURDIR)/.env
echo MORPH_ENDPOINT=http://$(NODE1):40332 >> $(CURDIR)/.env
echo HTTP_GATE=http://$(NODE1):8888 >> $(CURDIR)/.env
@ -101,12 +103,14 @@ setup-for-sbercloud:
echo STORAGE_WALLET_PATH_3="/.setup/wallets/node3-storage.json" >> $(CURDIR)/.env
echo STORAGE_WALLET_PATH_4="/.setup/wallets/node4-storage.json" >> $(CURDIR)/.env
echo MAINNET_WALLET_PATH="/.setup/alphabet-wallets/az.json" >> $(CURDIR)/.env
echo FREE_STORAGE=true >> $(CURDIR)/.env
NEOFS_ADM_EXEC="neofs-adm" >> $(CURDIR)/.env
NEOFS_ADM_CONFIG_PATH="/.setup/config.yaml" >> $(CURDIR)/.env
# env: files inside storage node to make calls via SSH on that node
echo STORAGE_NODE_BIN_PATH="/usr/local/bin/" >> $(CURDIR)/.env
echo STORAGE_NODE_CONFIG_PATH="/tmp/conf.yaml" >> $(CURDIR)/.env
# env: s3 gateway public key
echo S3_GATE_PUB_KEY=$(shell $(NEO_BIN_DIR)/neo-go wallet dump-keys -w $(CONFIG_DIR)/wallets/node1-s3.json | head -2 | tail -1) >> $(CURDIR)/.env
echo FREE_STORAGE=true >> $(CURDIR)/.env
.PHONY: pytest-docker
pytest-docker:

View file

@ -54,7 +54,6 @@ def crate_container_and_pick_node(prepare_wallet_and_deposit):
@pytest.fixture
@pytest.mark.skip(reason="docker API works only for devenv")
def start_node_if_needed():
yield
try:
@ -168,7 +167,6 @@ def test_placement_policy_negative(prepare_wallet_and_deposit, placement_rule, e
@pytest.mark.node_mgmt
@pytest.mark.skip(reason="docker API works only for devenv")
@allure.title('NeoFS object replication on node failover')
def test_replication(prepare_wallet_and_deposit, start_node_if_needed):
"""

View file

@ -61,10 +61,10 @@ def test_object_api(prepare_wallet_and_deposit, request, object_size):
with allure.step('Get range/range hash'):
range_hash = get_range_hash(**wallet_cid, oid=oids[0], bearer_token='', range_cut=range_cut)
assert get_file_hash(file_path, range_len) == range_hash, 'Expected range hash is correct'
range_hash = get_range_hash(**wallet_cid, oid=oids[1], bearer_token='', range_cut=range_cut)
assert get_file_hash(file_path, range_len) == range_hash, 'Expected range hash is correct'
_, got_content = get_range(**wallet_cid, oid=oids[1], file_path='s_get_range', bearer='', range_cut=range_cut)
assert get_file_content(file_path, content_len=range_len, mode='rb') == got_content, \
'Expected range content is correct'

View file

@ -1,10 +1,12 @@
#!/usr/bin/python3.9
import contract
from robot.api import logger
from robot.api.deco import keyword
from common import IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT
import contract
import wrappers
from common import (IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT, NEOFS_ADM_EXEC,
NEOFS_ADM_CONFIG_PATH)
ROBOT_AUTO_KEYWORDS = False
@ -22,6 +24,15 @@ def get_epoch():
@keyword('Tick Epoch')
def tick_epoch():
if NEOFS_ADM_EXEC and NEOFS_ADM_CONFIG_PATH:
# If neofs-adm is available, then we tick epoch with it (to be consistent with UAT tests)
cmd = f"{NEOFS_ADM_EXEC} morph force-new-epoch -c {NEOFS_ADM_CONFIG_PATH}"
logger.info(f"Executing shell command: {cmd}")
out = wrappers.run_sh(cmd)
logger.info(f"Command completed with output: {out}")
return
# Otherwise we tick epoch using transaction
cur_epoch = get_epoch()
return contract.invoke_contract_multisig(
contract.get_netmap_contract_hash(MORPH_ENDPOINT),

View file

@ -80,19 +80,26 @@ NEOFS_NETMAP = [i['rpc'] for i in NEOFS_NETMAP_DICT.values()]
NEOGO_EXECUTABLE = os.getenv('NEOGO_EXECUTABLE', 'neo-go')
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
# Config of user's wallet that we use to run the tests
WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/empty_passwd.yml"
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_CONFIG = os.getenv("MAINNET_WALLET_CONFIG", f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml")
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/wallet01.json")
IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml"
IR_WALLET_CONFIG = os.getenv("IR_WALLET_CONFIG", f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml")
IR_WALLET_PASS = os.getenv("IR_WALLET_PASS", "one")
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')
STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT = os.getenv('STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT', 'localhost:8091')
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", f"{DEVENV_PATH}/vendor/neofs-cli")
STORAGE_NODE_CONFIG_PATH = os.getenv("STORAGE_NODE_CONFIG_PATH", f"{DEVENV_PATH}/services/storage/cli-cfg.yml")
STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT = os.getenv("STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT", "localhost:8091")
# 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_PATH = os.getenv("NEOFS_ADM_CONFIG_PATH")
FREE_STORAGE = os.getenv('FREE_STORAGE', "false").lower() == "true"