forked from TrueCloudLab/frostfs-testcases
Fix config for neofs-cli in balance test
Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
114f0a1623
commit
59f7679b5d
1 changed files with 16 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -29,14 +30,12 @@ class TestBalanceAccounting:
|
||||||
rpc_endpoint=NEOFS_ENDPOINT,
|
rpc_endpoint=NEOFS_ENDPOINT,
|
||||||
address=self.address,
|
address=self.address,
|
||||||
)
|
)
|
||||||
logger.info(f"Out wallet+address: {output}")
|
|
||||||
assert int(output.stdout.rstrip()) == DEPOSIT_AMOUNT
|
assert int(output.stdout.rstrip()) == DEPOSIT_AMOUNT
|
||||||
|
|
||||||
@allure.title("Test balance request with wallet only")
|
@allure.title("Test balance request with wallet only")
|
||||||
def test_balance_wallet(self, client_shell):
|
def test_balance_wallet(self, client_shell):
|
||||||
cli = NeofsCli(client_shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
cli = NeofsCli(client_shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
||||||
output = cli.accounting.balance(wallet=self.user_wallet, rpc_endpoint=NEOFS_ENDPOINT)
|
output = cli.accounting.balance(wallet=self.user_wallet, rpc_endpoint=NEOFS_ENDPOINT)
|
||||||
logger.info(f"Out wallet: {output}")
|
|
||||||
assert int(output.stdout.rstrip()) == DEPOSIT_AMOUNT
|
assert int(output.stdout.rstrip()) == DEPOSIT_AMOUNT
|
||||||
|
|
||||||
@allure.title("Test balance request with wallet and wrong address")
|
@allure.title("Test balance request with wallet and wrong address")
|
||||||
|
@ -50,25 +49,28 @@ class TestBalanceAccounting:
|
||||||
)
|
)
|
||||||
|
|
||||||
@allure.title("Test balance request with config file")
|
@allure.title("Test balance request with config file")
|
||||||
def test_balance_api(self, client_shell):
|
def test_balance_api(self, prepare_tmp_dir, client_shell):
|
||||||
config_file = self.write_api_config(endpoint=NEOFS_ENDPOINT, wallet=self.user_wallet)
|
config_file = self.write_api_config(
|
||||||
logger.info(f"YAML: {config_file}")
|
config_dir=prepare_tmp_dir, endpoint=NEOFS_ENDPOINT, wallet=self.user_wallet
|
||||||
cli = NeofsCli(client_shell, NEOFS_CLI_EXEC, WALLET_CONFIG)
|
)
|
||||||
output = cli.accounting.balance()
|
logger.info(f"Config with API endpoint: {config_file}")
|
||||||
logger.info(f"Out api: {output.stdout}")
|
|
||||||
assert int(output.stdout.rstrip()) == DEPOSIT_AMOUNT
|
cli = NeofsCli(client_shell, NEOFS_CLI_EXEC, config_file=config_file)
|
||||||
|
result = cli.accounting.balance()
|
||||||
|
|
||||||
|
assert int(result.stdout.rstrip()) == DEPOSIT_AMOUNT
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@allure.step("Write YAML config")
|
@allure.step("Write config with API endpoint")
|
||||||
def write_api_config(endpoint: str, wallet: str) -> str:
|
def write_api_config(config_dir: str, endpoint: str, wallet: str) -> str:
|
||||||
with open(WALLET_CONFIG) as file:
|
with open(WALLET_CONFIG, "r") as file:
|
||||||
wallet_config = yaml.load(file, Loader=yaml.FullLoader)
|
wallet_config = yaml.full_load(file)
|
||||||
api_config = {
|
api_config = {
|
||||||
**wallet_config,
|
**wallet_config,
|
||||||
"rpc-endpoint": endpoint,
|
"rpc-endpoint": endpoint,
|
||||||
"wallet": wallet,
|
"wallet": wallet,
|
||||||
}
|
}
|
||||||
api_config_file = f"{ASSETS_DIR}/config.yaml"
|
api_config_file = os.path.join(config_dir, "neofs-cli-api-config.yaml")
|
||||||
with open(api_config_file, "w") as file:
|
with open(api_config_file, "w") as file:
|
||||||
yaml.dump(api_config, file)
|
yaml.dump(api_config, file)
|
||||||
return api_config_file
|
return api_config_file
|
||||||
|
|
Loading…
Reference in a new issue