Add post-init for load params #79

Merged
abereziny merged 1 commit from abereziny/frostfs-testlib:feature-add-post-init-for-load-config into master 2023-09-06 19:26:40 +00:00

View file

@ -271,6 +271,16 @@ class LoadParams:
return env_vars
def __post_init__(self):
default_scenario_map = {
LoadType.gRPC: LoadScenario.gRPC,
LoadType.HTTP: LoadScenario.HTTP,
LoadType.S3: LoadScenario.S3,
}
if self.scenario is None:
self.scenario = default_scenario_map[self.load_type]
def get_preset_arguments(self):
command_args = [
self._get_preset_argument(meta_field)
@ -324,7 +334,7 @@ class LoadParams:
# TODO: migrate load_params defaults to testlib
if self.object_size is not None:
size, unit = calc_unit(self.object_size, 1)
static_params = [f"{load_type_str} ({size:.4g} {unit})"]
static_params = [f"{load_type_str} {size:.4g} {unit}"]
else:
static_params = [f"{load_type_str}"]
@ -335,7 +345,7 @@ class LoadParams:
]
params = ", ".join(static_params + dynamic_params)
return f"load: {params}"
return params
def __repr__(self) -> str:
return self.__str__()