frostfs-testcases/robot/resources/lib/python_keywords/epoch.py
Vladimir Domnich 6e23e7d454 Simplify test checks and fixtures:
Remove default SSH key path.
Replace multiple fixtures for file generation with single function.
Rename references to keyword modules.
Update pytest test cases to be consistent with new keywords.
Remove gas balance checks from container operations.
Add logic to run initial gas transfer only if storage is not free.
Remove robot testsuites for s3 and http gateways.
S3 and http tests are covered and will be maintained in the future in pytest.

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
2022-07-08 17:45:32 +03:00

41 lines
1.1 KiB
Python

#!/usr/bin/python3.9
import contract
import sys
from robot.api import logger
from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn
ROBOT_AUTO_KEYWORDS = False
if "pytest" in sys.modules:
import os
IR_WALLET_PATH = os.getenv("IR_WALLET_PATH")
IR_WALLET_PASS = os.getenv("IR_WALLET_PASS")
SIDECHAIN_EP = os.getenv("MORPH_ENDPOINT")
else:
IR_WALLET_PATH = BuiltIn().get_variable_value("${IR_WALLET_PATH}")
IR_WALLET_PASS = BuiltIn().get_variable_value("${IR_WALLET_PASS}")
SIDECHAIN_EP = BuiltIn().get_variable_value("${MORPH_ENDPOINT}")
@keyword('Get Epoch')
def get_epoch():
epoch = int(contract.testinvoke_contract(
contract.get_netmap_contract_hash(SIDECHAIN_EP),
'epoch',
SIDECHAIN_EP)
)
logger.info(f"Got epoch {epoch}")
return epoch
@keyword('Tick Epoch')
def tick_epoch():
cur_epoch = get_epoch()
return contract.invoke_contract_multisig(
contract.get_netmap_contract_hash(SIDECHAIN_EP),
f"newEpoch int:{cur_epoch+1}",
IR_WALLET_PATH, IR_WALLET_PASS, SIDECHAIN_EP)