From 79775dac818a4a2328e19d861d549815c34d9210 Mon Sep 17 00:00:00 2001 From: Petr Stodulka Date: Mon, 15 Jul 2024 06:01:21 +0200 Subject: [PATCH 79/92] Add unit tests for config.version.get_major_version() Based on the bug fixed in the previuos commit, we are rather adding unit-tests for get_major_version() function in common libraries, to prevent possible issues in future there too. --- .../common/libraries/config/tests/test_version.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/repos/system_upgrade/common/libraries/config/tests/test_version.py b/repos/system_upgrade/common/libraries/config/tests/test_version.py index 4ef7e506..303e4de5 100644 --- a/repos/system_upgrade/common/libraries/config/tests/test_version.py +++ b/repos/system_upgrade/common/libraries/config/tests/test_version.py @@ -121,3 +121,17 @@ def test_is_rhel_realtime(monkeypatch, result, kernel, release_id): monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(src_ver='7.9', kernel=kernel, release_id=release_id)) assert version.is_rhel_realtime() == result + + +@pytest.mark.parametrize('result,sys_version', [ + ('7', '7.1.0'), + ('7', '7.9'), + ('7', '7'), + ('8', '8.10'), + ('10', '10.0'), + ('10', '10.10.0'), + ('10', '10.0'), + ('10', '10'), +]) +def test_get_major_version(result, sys_version): + assert version.get_major_version(sys_version) == result -- 2.42.0