leapp-repository/0079-Add-unit-tests-for-config.version.get_major_version.patch
Toshio Kuratomi d9029cec24 CTC2 candidate 1 (Release for 8.10/9.5)
- Improve set_systemd_services_states logging
- [IPU 7 -> 8] Fix detection of bootable device on RAID
- Fix detection of valid sshd config with internal-sftp subsystem in Leapp
- Handle a false positive GPG check error when TargetUserSpaceInfo is missing
- Fix failing "update-ca-trust" command caused by missing util-linux package
- Improve report when a system is unsupported
- Fix handling of versions in RHUI configuration for ELS and SAP upgrades
- Add missing RHUI GCP config info for RHEL for SAP

- Resolves: RHEL-33902, RHEL-30573, RHEL-43978, RHEL-39046, RHEL-39047, RHEL-39049
2024-07-25 00:55:43 -07:00

38 lines
1.5 KiB
Diff

From 79775dac818a4a2328e19d861d549815c34d9210 Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk@redhat.com>
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