forked from TrueCloudLab/frostfs-testcases
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>
This commit is contained in:
parent
8acf738147
commit
6e23e7d454
14 changed files with 122 additions and 335 deletions
0
robot/resources/lib/python_keywords/__init__.py
Normal file
0
robot/resources/lib/python_keywords/__init__.py
Normal file
|
@ -2,13 +2,23 @@
|
|||
|
||||
|
||||
import contract
|
||||
import sys
|
||||
from robot.api import logger
|
||||
from robot.api.deco import keyword
|
||||
from robot.libraries.BuiltIn import BuiltIn
|
||||
|
||||
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}")
|
||||
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')
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import hashlib
|
||||
import os
|
||||
import tarfile
|
||||
from typing import Tuple
|
||||
import uuid
|
||||
|
||||
import docker
|
||||
|
@ -17,10 +18,26 @@ from cli_helpers import _cmd_run
|
|||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
||||
@keyword('Generate file')
|
||||
def generate_file_and_file_hash(size: int) -> str:
|
||||
def generate_file(size: int = SIMPLE_OBJ_SIZE) -> str:
|
||||
"""
|
||||
Function generates a big binary file with the specified size in bytes
|
||||
Function generates a binary file with the specified size in bytes.
|
||||
Args:
|
||||
size (int): the size in bytes, can be declared as 6e+6 for example
|
||||
Returns:
|
||||
(str): the path to the generated file
|
||||
"""
|
||||
file_path = f"{os.getcwd()}/{ASSETS_DIR}/{str(uuid.uuid4())}"
|
||||
with open(file_path, 'wb') as fout:
|
||||
fout.write(os.urandom(size))
|
||||
logger.info(f"file with size {size} bytes has been generated: {file_path}")
|
||||
|
||||
return file_path
|
||||
|
||||
|
||||
@keyword('Generate file')
|
||||
def generate_file_and_file_hash(size: int) -> Tuple[str, str]:
|
||||
"""
|
||||
Function generates a binary file with the specified size in bytes
|
||||
and its hash.
|
||||
Args:
|
||||
size (int): the size in bytes, can be declared as 6e+6 for example
|
||||
|
@ -28,14 +45,10 @@ def generate_file_and_file_hash(size: int) -> str:
|
|||
(str): the path to the generated file
|
||||
(str): the hash of the generated file
|
||||
"""
|
||||
filename = f"{os.getcwd()}/{ASSETS_DIR}/{str(uuid.uuid4())}"
|
||||
with open(filename, 'wb') as fout:
|
||||
fout.write(os.urandom(size))
|
||||
logger.info(f"file with size {size} bytes has been generated: {filename}")
|
||||
file_path = generate_file(size)
|
||||
file_hash = get_file_hash(file_path)
|
||||
|
||||
file_hash = get_file_hash(filename)
|
||||
|
||||
return filename, file_hash
|
||||
return file_path, file_hash
|
||||
|
||||
|
||||
@keyword('Get File Hash')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue