forked from TrueCloudLab/frostfs-testlib
Fix string representation for load params with empty fields
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
b856e82008
commit
612e088763
3 changed files with 43 additions and 8 deletions
|
@ -3,7 +3,17 @@ from typing import Any, get_args
|
|||
|
||||
import pytest
|
||||
|
||||
from frostfs_testlib.load.load_config import LoadParams, LoadScenario, LoadType, Preset
|
||||
from frostfs_testlib.load.load_config import (
|
||||
EndpointSelectionStrategy,
|
||||
LoadParams,
|
||||
LoadScenario,
|
||||
LoadType,
|
||||
Preset,
|
||||
)
|
||||
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
|
||||
|
@ -36,7 +46,10 @@ class TestLoadConfig:
|
|||
return self._get_filled_load_params(load_type, load_scenario, set_empty)
|
||||
|
||||
def test_load_params_only_load_type_required(self):
|
||||
LoadParams(load_type=LoadType.S3)
|
||||
load_params = LoadParams(load_type=LoadType.S3)
|
||||
expected = "load: s3"
|
||||
assert repr(load_params) == expected
|
||||
assert f"{load_params}" == expected
|
||||
|
||||
def test_load_params_initially_have_all_values_none(self):
|
||||
load_params = LoadParams(load_type=LoadType.S3)
|
||||
|
@ -60,6 +73,17 @@ class TestLoadConfig:
|
|||
assert f"{load_params}" == expected
|
||||
assert repr(load_params) == expected
|
||||
|
||||
@pytest.mark.parametrize("load_params", [LoadScenario.gRPC], indirect=True)
|
||||
def test_load_controller_string_representation(self, load_params: LoadParams):
|
||||
load_params.endpoint_selection_strategy = EndpointSelectionStrategy.ALL
|
||||
load_params.object_size = 512
|
||||
background_load_controller = BackgroundLoadController(
|
||||
"tmp", load_params, "wallet", None, None
|
||||
)
|
||||
expected = "load: grpc (512 KiB), writers=7, readers=7, deleters=8"
|
||||
assert f"{background_load_controller}" == expected
|
||||
assert repr(background_load_controller) == expected
|
||||
|
||||
def test_load_set_id_changes_fields(self):
|
||||
load_params = LoadParams(load_type=LoadType.S3)
|
||||
load_params.preset = Preset()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue