forked from TrueCloudLab/frostfs-testlib
[#350] Add ape rule for load config
Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
parent
aed20e02ac
commit
0015ea7f93
2 changed files with 39 additions and 4 deletions
|
@ -182,8 +182,10 @@ class Preset(MetaConfig):
|
||||||
pregen_json: Optional[str] = metadata_field(all_load_scenarios, "out", "PREGEN_JSON", False)
|
pregen_json: Optional[str] = metadata_field(all_load_scenarios, "out", "PREGEN_JSON", False)
|
||||||
# Workers count for preset
|
# Workers count for preset
|
||||||
workers: Optional[int] = metadata_field(all_load_scenarios, "workers", None, False)
|
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)
|
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 ------
|
# ------ GRPC ------
|
||||||
# Amount of containers which should be created
|
# Amount of containers which should be created
|
||||||
|
|
|
@ -6,10 +6,7 @@ import pytest
|
||||||
from frostfs_testlib.load.load_config import EndpointSelectionStrategy, LoadParams, LoadScenario, LoadType, Preset, ReadFrom
|
from frostfs_testlib.load.load_config import EndpointSelectionStrategy, LoadParams, LoadScenario, LoadType, Preset, ReadFrom
|
||||||
from frostfs_testlib.load.runners import DefaultRunner
|
from frostfs_testlib.load.runners import DefaultRunner
|
||||||
from frostfs_testlib.resources.load_params import BACKGROUND_LOAD_DEFAULT_VU_INIT_TIME
|
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.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
|
@dataclass
|
||||||
|
@ -129,6 +126,8 @@ class TestLoadConfig:
|
||||||
"--size '11'",
|
"--size '11'",
|
||||||
"--acl 'acl'",
|
"--acl 'acl'",
|
||||||
"--preload_obj '13'",
|
"--preload_obj '13'",
|
||||||
|
"--retry '24'",
|
||||||
|
"--rule 'rule' --rule 'rule_2'",
|
||||||
"--out 'pregen_json'",
|
"--out 'pregen_json'",
|
||||||
"--workers '7'",
|
"--workers '7'",
|
||||||
"--containers '16'",
|
"--containers '16'",
|
||||||
|
@ -161,6 +160,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '11'",
|
"--size '11'",
|
||||||
"--preload_obj '13'",
|
"--preload_obj '13'",
|
||||||
|
"--retry '24'",
|
||||||
|
"--rule 'rule' --rule 'rule_2'",
|
||||||
"--out 'pregen_json'",
|
"--out 'pregen_json'",
|
||||||
"--workers '7'",
|
"--workers '7'",
|
||||||
"--containers '16'",
|
"--containers '16'",
|
||||||
|
@ -317,6 +318,8 @@ class TestLoadConfig:
|
||||||
"--no-verify-ssl",
|
"--no-verify-ssl",
|
||||||
"--size '11'",
|
"--size '11'",
|
||||||
"--preload_obj '13'",
|
"--preload_obj '13'",
|
||||||
|
"--retry '24'",
|
||||||
|
"--rule 'rule' --rule 'rule_2'",
|
||||||
"--out 'pregen_json'",
|
"--out 'pregen_json'",
|
||||||
"--workers '7'",
|
"--workers '7'",
|
||||||
"--containers '16'",
|
"--containers '16'",
|
||||||
|
@ -350,6 +353,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '11'",
|
"--size '11'",
|
||||||
"--preload_obj '13'",
|
"--preload_obj '13'",
|
||||||
|
"--retry '24'",
|
||||||
|
"--rule 'rule' --rule 'rule_2'",
|
||||||
"--out 'pregen_json'",
|
"--out 'pregen_json'",
|
||||||
"--workers '7'",
|
"--workers '7'",
|
||||||
"--containers '16'",
|
"--containers '16'",
|
||||||
|
@ -415,6 +420,26 @@ class TestLoadConfig:
|
||||||
|
|
||||||
self._check_preset_params(load_params, params)
|
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)
|
@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):
|
def test_argument_parsing_for_s3_verify_scenario(self, load_params: LoadParams):
|
||||||
expected_env_vars = {
|
expected_env_vars = {
|
||||||
|
@ -444,6 +469,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '0'",
|
"--size '0'",
|
||||||
"--preload_obj '0'",
|
"--preload_obj '0'",
|
||||||
|
"--retry '0'",
|
||||||
|
"--rule ''",
|
||||||
"--out ''",
|
"--out ''",
|
||||||
"--workers '0'",
|
"--workers '0'",
|
||||||
"--containers '0'",
|
"--containers '0'",
|
||||||
|
@ -475,6 +502,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '0'",
|
"--size '0'",
|
||||||
"--preload_obj '0'",
|
"--preload_obj '0'",
|
||||||
|
"--retry '0'",
|
||||||
|
"--rule ''",
|
||||||
"--out ''",
|
"--out ''",
|
||||||
"--workers '0'",
|
"--workers '0'",
|
||||||
"--containers '0'",
|
"--containers '0'",
|
||||||
|
@ -582,6 +611,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '0'",
|
"--size '0'",
|
||||||
"--preload_obj '0'",
|
"--preload_obj '0'",
|
||||||
|
"--retry '0'",
|
||||||
|
"--rule ''",
|
||||||
"--out ''",
|
"--out ''",
|
||||||
"--workers '0'",
|
"--workers '0'",
|
||||||
"--containers '0'",
|
"--containers '0'",
|
||||||
|
@ -613,6 +644,8 @@ class TestLoadConfig:
|
||||||
expected_preset_args = [
|
expected_preset_args = [
|
||||||
"--size '0'",
|
"--size '0'",
|
||||||
"--preload_obj '0'",
|
"--preload_obj '0'",
|
||||||
|
"--retry '0'",
|
||||||
|
"--rule ''",
|
||||||
"--out ''",
|
"--out ''",
|
||||||
"--workers '0'",
|
"--workers '0'",
|
||||||
"--containers '0'",
|
"--containers '0'",
|
||||||
|
|
Loading…
Reference in a new issue