[#350] Add ape rule for load config #350

Merged
abereziny merged 1 commit from abereziny/frostfs-testlib:feature-13181 into master 2025-01-24 14:42:45 +00:00
2 changed files with 39 additions and 4 deletions

View file

@ -182,8 +182,10 @@ class Preset(MetaConfig):
pregen_json: Optional[str] = metadata_field(all_load_scenarios, "out", "PREGEN_JSON", False)
# Workers count for preset
workers: Optional[int] = metadata_field(all_load_scenarios, "workers", None, False)
# Acl for container/buckets
# TODO: Deprecated. Acl for container/buckets
acl: Optional[str] = metadata_field(all_load_scenarios, "acl", None, False)
# APE rule for containers instead of deprecated ACL
rule: Optional[list[str]] = metadata_field(grpc_preset_scenarios, "rule", None, False, formatter=force_list)
# ------ GRPC ------
# Amount of containers which should be created

View file

@ -6,10 +6,7 @@ import pytest
from frostfs_testlib.load.load_config import EndpointSelectionStrategy, LoadParams, LoadScenario, LoadType, Preset, ReadFrom
from frostfs_testlib.load.runners import DefaultRunner
from frostfs_testlib.resources.load_params import BACKGROUND_LOAD_DEFAULT_VU_INIT_TIME
from frostfs_testlib.storage.cluster import ClusterNode
from frostfs_testlib.storage.controllers.background_load_controller import BackgroundLoadController
from frostfs_testlib.storage.dataclasses.frostfs_services import StorageNode
from frostfs_testlib.storage.dataclasses.node_base import NodeBase
@dataclass
@ -129,6 +126,8 @@ class TestLoadConfig:
"--size '11'",
"--acl 'acl'",
"--preload_obj '13'",
"--retry '24'",
"--rule 'rule' --rule 'rule_2'",
"--out 'pregen_json'",
"--workers '7'",
"--containers '16'",
@ -161,6 +160,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '11'",
"--preload_obj '13'",
"--retry '24'",
"--rule 'rule' --rule 'rule_2'",
"--out 'pregen_json'",
"--workers '7'",
"--containers '16'",
@ -317,6 +318,8 @@ class TestLoadConfig:
"--no-verify-ssl",
"--size '11'",
"--preload_obj '13'",
"--retry '24'",
"--rule 'rule' --rule 'rule_2'",
"--out 'pregen_json'",
"--workers '7'",
"--containers '16'",
@ -350,6 +353,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '11'",
"--preload_obj '13'",
"--retry '24'",
"--rule 'rule' --rule 'rule_2'",
"--out 'pregen_json'",
"--workers '7'",
"--containers '16'",
@ -415,6 +420,26 @@ class TestLoadConfig:
self._check_preset_params(load_params, params)
@pytest.mark.parametrize(
"load_type, input, value, params",
[
(LoadType.gRPC, ["A C ", " B"], ["A C", "B"], [f"--rule 'A C' --rule 'B'"]),
(LoadType.gRPC, " A ", ["A"], ["--rule 'A'"]),
(LoadType.gRPC, " A , B ", ["A , B"], ["--rule 'A , B'"]),
(LoadType.gRPC, [" A", "B "], ["A", "B"], ["--rule 'A' --rule 'B'"]),
(LoadType.gRPC, None, None, []),
(LoadType.S3, ["A C ", " B"], ["A C", "B"], []),
(LoadType.S3, None, None, []),
],
)
def test_ape_list_parsing_formatter(self, load_type, input, value, params):
load_params = LoadParams(load_type)
load_params.preset = Preset()
load_params.preset.rule = input
assert load_params.preset.rule == value
self._check_preset_params(load_params, params)
@pytest.mark.parametrize("load_params, load_type", [(LoadScenario.VERIFY, LoadType.S3)], indirect=True)
def test_argument_parsing_for_s3_verify_scenario(self, load_params: LoadParams):
expected_env_vars = {
@ -444,6 +469,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '0'",
"--preload_obj '0'",
"--retry '0'",
"--rule ''",
"--out ''",
"--workers '0'",
"--containers '0'",
@ -475,6 +502,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '0'",
"--preload_obj '0'",
"--retry '0'",
"--rule ''",
"--out ''",
"--workers '0'",
"--containers '0'",
@ -582,6 +611,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '0'",
"--preload_obj '0'",
"--retry '0'",
"--rule ''",
"--out ''",
"--workers '0'",
"--containers '0'",
@ -613,6 +644,8 @@ class TestLoadConfig:
expected_preset_args = [
"--size '0'",
"--preload_obj '0'",
"--retry '0'",
"--rule ''",
"--out ''",
"--workers '0'",
"--containers '0'",