From 23c7d05d304844ba9df71057c3d4a19c6616f143 Mon Sep 17 00:00:00 2001 From: Iker Pedrosa Date: Wed, 8 Jan 2025 16:31:06 +0100 Subject: [PATCH] tests: improve feature presence automation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `files-provider` stopped being shipped in Fedora 40 in sssd-2.9. Thus, the detection matrix need to be updated to take this into account. In addition, the assertion messages weren't clear enough, so I've improved them to understand them at a first glance. Signed-off-by: Iker Pedrosa Reviewed-by: Alexey Tikhonov Reviewed-by: Jakub Vávra (cherry picked from commit 067dbf614d8aa4d00bec3425740762ff65890b37) --- src/tests/system/tests/test_feature.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tests/system/tests/test_feature.py b/src/tests/system/tests/test_feature.py index fd26959cad..e354fb44c7 100644 --- a/src/tests/system/tests/test_feature.py +++ b/src/tests/system/tests/test_feature.py @@ -19,7 +19,7 @@ ("Red Hat Enterprise Linux", 9, 4, 2, 9, "passkey", True), ("Ubuntu", 23, 10, 2, 9, "passkey", True), (None, None, None, 2, 10, "knownhosts", True), - ("Fedora", 40, 0, 2, 10, "files-provider", False), + ("Fedora", 40, 0, 2, 9, "files-provider", False), ("CentOS Stream", 10, 0, 2, 10, "files-provider", False), ("Red Hat Enterprise Linux", 10, 0, 2, 10, "files-provider", False), (None, None, None, 2, 10, "ldap_use_ppolicy", True), @@ -75,12 +75,14 @@ def test_feature__presence( if sssd_version["major"] > sssd_major or ( sssd_version["major"] == sssd_major and sssd_version["minor"] >= sssd_minor ): - assert client.features[feature] == presence, ( - f"Feature {feature} should be present in {distribution} {distro_major}.{distro_minor} with " - "sssd-{sssd_major}.{sssd_minor}" - ) + state = "" if presence else "not" + expected = presence else: - assert client.features[feature] != presence, ( - f"Feature {feature} should not be present in {distribution} {distro_major}.{distro_minor} with " - "sssd-{sssd_major}.{sssd_minor}" - ) + state = "not" if presence else "" + expected = not presence + + assert client.features[feature] == expected, ( + f"Feature {feature} should {state} be present in {client.host.distro_name} " + f"{client.host.distro_major}.{client.host.distro_minor} with " + f"sssd-{sssd_version['major']}.{sssd_version['minor']}" + )