Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: missed changes for network config tests #631

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading