Skip to content

Commit

Permalink
tests: missed changes for network config tests
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Sep 7, 2023
1 parent a6f8426 commit ab69722
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions pytest_tests/testsuites/network/test_config_changes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union
from typing import Optional, Union

import allure
import pytest
Expand Down Expand Up @@ -73,13 +73,15 @@ def test_config_update_multiple_values(self, clean_config: None):
)
@allure.title("Set network config key to invalid value")
def test_config_set_invalid_value(self, key: str, value: Union[str, int, bool]):
self._set_and_verify_config_keys(**{key: value})
with pytest.raises(RuntimeError, match=f".*could not parse.*"):
self._set_and_verify_config_keys(**{key: value})

@allure.title("Set multiple network config keys to invalid values with force")
def test_config_set_multiple_invalid_values(self):
self._set_and_verify_config_keys(
**{"MaxObjectSize": "VeryBigSize", "BasicIncomeRate": False}, force=True
)
with pytest.raises(RuntimeError, match=f".*could not parse.*"):
self._set_and_verify_config_keys(
**{"MaxObjectSize": "VeryBigSize", "BasicIncomeRate": False}, force=True
)

@allure.title("Set network config unknown key")
def test_config_set_unknown_key(self):
Expand All @@ -88,11 +90,22 @@ def test_config_set_unknown_key(self):

@allure.title("Set network config unknown key with force")
def test_config_force_set_unknown_key(self):
self._set_and_verify_config_keys(**{"unknown_key": 120}, force=True)
with pytest.raises(AssertionError):
self._set_and_verify_config_keys(
**{"unknown_key": 120},
force=True,
config_keys_mapping={"unknown_key": "unknown_key"},
)

def _set_and_verify_config_keys(
self, force: bool = False, **key_value_pairs: dict[str, Union[str, int, bool]]
self,
force: bool = False,
config_keys_mapping: Optional[dict[str]] = None,
**key_value_pairs: dict[str, Union[str, int, bool]],
):
if config_keys_mapping is None:
config_keys_mapping = CONFIG_KEYS_MAPPING

ir_node = self.cluster.ir_nodes[0]
morph_chain = self.cluster.morph_chain_nodes[0]
neofsadm = NeofsAdm(
Expand Down Expand Up @@ -122,7 +135,7 @@ def _set_and_verify_config_keys(
)

for key, value in key_value_pairs.items():
assert net_info[CONFIG_KEYS_MAPPING[key]] == value
assert net_info[config_keys_mapping[key]] == value

@pytest.fixture(scope="function")
def clean_config(self) -> None:
Expand Down

0 comments on commit ab69722

Please sign in to comment.