Add post-init for load params

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-09-06 16:51:18 +03:00
parent 449c18bb1a
commit e14896400f

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__()