forked from TrueCloudLab/frostfs-testcases
Add timeout for cli commands
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
ac7dae0d2d
commit
06dc226ef8
5 changed files with 69 additions and 14 deletions
|
@ -12,7 +12,7 @@ from frostfs_testlib.shell import Shell
|
|||
from pytest_tests.helpers.cluster import Cluster
|
||||
from pytest_tests.helpers.complex_object_actions import get_link_object
|
||||
from pytest_tests.helpers.frostfs_verbs import head_object
|
||||
from pytest_tests.resources.common import FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||
from pytest_tests.resources.common import CLI_DEFAULT_TIMEOUT, FROSTFS_CLI_EXEC, WALLET_CONFIG
|
||||
|
||||
logger = logging.getLogger("NeoLogger")
|
||||
|
||||
|
@ -27,6 +27,7 @@ def put_storagegroup(
|
|||
bearer: Optional[str] = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
lifetime: int = 10,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
) -> str:
|
||||
"""
|
||||
Wrapper for `frostfs-cli storagegroup put`. Before the SG is created,
|
||||
|
@ -40,6 +41,7 @@ def put_storagegroup(
|
|||
objects: List of Object IDs to include into the SG.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to frostfs-cli config file.
|
||||
timeout: Timeout for an operation.
|
||||
Returns:
|
||||
Object ID of created Storage Group.
|
||||
"""
|
||||
|
@ -66,6 +68,7 @@ def list_storagegroup(
|
|||
cid: str,
|
||||
bearer: Optional[str] = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
) -> list:
|
||||
"""
|
||||
Wrapper for `frostfs-cli storagegroup list`. This operation
|
||||
|
@ -76,6 +79,7 @@ def list_storagegroup(
|
|||
cid: ID of Container to list.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to frostfs-cli config file.
|
||||
timeout: Timeout for an operation.
|
||||
Returns:
|
||||
Object IDs of found Storage Groups.
|
||||
"""
|
||||
|
@ -87,6 +91,7 @@ def list_storagegroup(
|
|||
cid=cid,
|
||||
bearer=bearer,
|
||||
rpc_endpoint=endpoint,
|
||||
timeout=timeout,
|
||||
)
|
||||
# throwing off the first string of output
|
||||
found_objects = result.stdout.split("\n")[1:]
|
||||
|
@ -102,6 +107,7 @@ def get_storagegroup(
|
|||
gid: str,
|
||||
bearer: str = "",
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
) -> dict:
|
||||
"""
|
||||
Wrapper for `frostfs-cli storagegroup get`.
|
||||
|
@ -112,6 +118,7 @@ def get_storagegroup(
|
|||
gid: ID of the Storage Group.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to frostfs-cli config file.
|
||||
timeout: Timeout for an operation.
|
||||
Returns:
|
||||
Detailed information on the Storage Group.
|
||||
"""
|
||||
|
@ -124,6 +131,7 @@ def get_storagegroup(
|
|||
bearer=bearer,
|
||||
id=gid,
|
||||
rpc_endpoint=endpoint,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
# TODO: temporary solution for parsing output. Needs to be replaced with
|
||||
|
@ -153,6 +161,7 @@ def delete_storagegroup(
|
|||
gid: str,
|
||||
bearer: str = "",
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
) -> str:
|
||||
"""
|
||||
Wrapper for `frostfs-cli storagegroup delete`.
|
||||
|
@ -163,6 +172,7 @@ def delete_storagegroup(
|
|||
gid: ID of the Storage Group.
|
||||
bearer: Path to Bearer token file.
|
||||
wallet_config: Path to frostfs-cli config file.
|
||||
timeout: Timeout for an operation.
|
||||
Returns:
|
||||
Tombstone ID of the deleted Storage Group.
|
||||
"""
|
||||
|
@ -175,6 +185,7 @@ def delete_storagegroup(
|
|||
bearer=bearer,
|
||||
id=gid,
|
||||
rpc_endpoint=endpoint,
|
||||
timeout=timeout,
|
||||
)
|
||||
tombstone_id = result.stdout.strip().split("\n")[1].split(": ")[1]
|
||||
return tombstone_id
|
||||
|
@ -189,6 +200,7 @@ def verify_list_storage_group(
|
|||
gid: str,
|
||||
bearer: str = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
):
|
||||
storage_groups = list_storagegroup(
|
||||
shell=shell,
|
||||
|
@ -197,6 +209,7 @@ def verify_list_storage_group(
|
|||
cid=cid,
|
||||
bearer=bearer,
|
||||
wallet_config=wallet_config,
|
||||
timeout=timeout,
|
||||
)
|
||||
assert gid in storage_groups
|
||||
|
||||
|
@ -213,6 +226,7 @@ def verify_get_storage_group(
|
|||
max_object_size: int,
|
||||
bearer: str = None,
|
||||
wallet_config: str = WALLET_CONFIG,
|
||||
timeout: Optional[str] = CLI_DEFAULT_TIMEOUT,
|
||||
):
|
||||
obj_parts = []
|
||||
endpoint = cluster.default_rpc_endpoint
|
||||
|
@ -226,6 +240,7 @@ def verify_get_storage_group(
|
|||
nodes=cluster.storage_nodes,
|
||||
bearer=bearer,
|
||||
wallet_config=wallet_config,
|
||||
timeout=timeout,
|
||||
)
|
||||
obj_head = head_object(
|
||||
wallet=wallet,
|
||||
|
@ -236,6 +251,7 @@ def verify_get_storage_group(
|
|||
is_raw=True,
|
||||
bearer=bearer,
|
||||
wallet_config=wallet_config,
|
||||
timeout=timeout,
|
||||
)
|
||||
obj_parts = obj_head["header"]["split"]["children"]
|
||||
|
||||
|
@ -248,6 +264,7 @@ def verify_get_storage_group(
|
|||
gid=gid,
|
||||
bearer=bearer,
|
||||
wallet_config=wallet_config,
|
||||
timeout=timeout,
|
||||
)
|
||||
exp_size = object_size * obj_num
|
||||
if object_size < max_object_size:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue