[#139] Use readers for init time calculation

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-11-30 13:50:57 +03:00 committed by Andrey Berezin
parent 81dfc723da
commit ae566b413b
2 changed files with 57 additions and 53 deletions

View file

@ -12,6 +12,7 @@ from frostfs_testlib.load.load_config import (
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
@ -53,6 +54,25 @@ class TestLoadConfig:
assert repr(load_params) == expected
assert f"{load_params}" == expected
def test_load_params_init_time(self):
load_params = LoadParams(load_type=LoadType.S3)
vus = 100
load_params.vu_init_time = BACKGROUND_LOAD_DEFAULT_VU_INIT_TIME
# Used in time calculations
load_params.readers = vus
load_params.writers = vus
load_params.preallocated_readers = vus
load_params.preallocated_writers = vus
# Not used in time calculations
load_params.deleters = vus
load_params.preallocated_deleters = vus
expected = vus * 4 * BACKGROUND_LOAD_DEFAULT_VU_INIT_TIME
actual = load_params.get_init_time()
assert actual == expected, "Incorrect time for get_init_time()"
def test_load_params_initially_have_all_values_none(self):
load_params = LoadParams(load_type=LoadType.S3)
self._check_all_values_none(load_params, ["load_type", "scenario"])
@ -285,9 +305,7 @@ class TestLoadConfig:
self._check_preset_params(load_params, expected_preset_args)
self._check_env_vars(load_params, expected_env_vars)
@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):
expected_env_vars = {
"CLIENTS": 14,
@ -299,9 +317,7 @@ class TestLoadConfig:
self._check_env_vars(load_params, expected_env_vars)
@pytest.mark.parametrize(
"load_params, load_type", [(LoadScenario.VERIFY, LoadType.gRPC)], indirect=True
)
@pytest.mark.parametrize("load_params, load_type", [(LoadScenario.VERIFY, LoadType.gRPC)], indirect=True)
def test_argument_parsing_for_grpc_verify_scenario(self, load_params: LoadParams):
expected_env_vars = {
"CLIENTS": 14,
@ -339,9 +355,7 @@ class TestLoadConfig:
self._check_preset_params(load_params, expected_preset_args)
self._check_env_vars(load_params, expected_env_vars)
@pytest.mark.parametrize(
"load_params, set_empty", [(LoadScenario.gRPC_CAR, True)], indirect=True
)
@pytest.mark.parametrize("load_params, set_empty", [(LoadScenario.gRPC_CAR, True)], indirect=True)
def test_empty_argument_parsing_for_grpc_car_scenario(self, load_params: LoadParams):
expected_preset_args = [
"--size '0'",