From fa8b835b7b0073b9b1db5c77ead5785927111a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Strelec?= Date: Fri, 27 Oct 2023 18:41:46 +0200 Subject: [PATCH] Update `test_positive_all_packages_update` (#12342) * add test_positive_fm_packages_check_update * add capsule marker * add regex to find packages to update * remove duplicate test * update regex to match if there's multiple packages (cherry picked from commit b2d4f9832ac250848a17959f47c2736a648b15e5) --- tests/foreman/destructive/test_packages.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/foreman/destructive/test_packages.py b/tests/foreman/destructive/test_packages.py index 3a31e354e46..05c44bf1501 100644 --- a/tests/foreman/destructive/test_packages.py +++ b/tests/foreman/destructive/test_packages.py @@ -16,11 +16,14 @@ :Upstream: No """ +import re + import pytest pytestmark = pytest.mark.destructive +@pytest.mark.include_capsule def test_positive_all_packages_update(target_sat): """Verify update and check-update work as expected. @@ -48,5 +51,10 @@ def test_positive_all_packages_update(target_sat): target_sat.power_control(state='reboot') # Run check-update again to verify there are no more packages available to update result = target_sat.cli.Packages.check_update() + # Regex to match if there are packages available to update + # Matches lines like '\n\nwalrus.noarch 5.21-1 custom_repo\n' + pattern = '(\\n){1,2}(\\S+)(\\s+)(\\S+)(\\s+)(\\S+)(\\n)' + matches = re.search(pattern, result.stdout) + assert matches is None # No packages available to update assert 'FAIL' not in result.stdout assert result.status == 0