Skip to content

Commit 5b0d88f

Browse files
committed
[6.17.z] test_negative_remove_satellite_packages 6.17.z update
Proposing change of assert for both scenarios - Removing the protected package itself (e.g., yum remove satellite) - Removing a dependency of a protected package (e.g., yum remove foreman) In result output messages can differ for example yum output can be - removing the following protected packages: satellite - broken dependencies for the following protected packages: satellite Both should be valid.
1 parent 0441f03 commit 5b0d88f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/foreman/destructive/test_packages.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ def test_negative_remove_satellite_packages(sat_maintain):
7979
package_list = ['foreman', 'foreman-proxy', 'katello', 'wget', 'satellite']
8080
else:
8181
package_list = ['foreman-proxy', 'satellite-capsule']
82+
# DNF reports either "removing the following protected packages" (direct removal)
83+
# or "broken dependencies for the following protected packages" (dependency removal),
84+
# so we match the common substring that covers both cases.
85+
protected_pkg = 'satellite' if isinstance(sat_maintain, Satellite) else 'satellite-capsule'
8286
for package in package_list:
8387
result = sat_maintain.execute(f'yum remove {package}')
8488
assert result.status != 0
85-
assert (
86-
'Problem: The operation would result in removing the following protected packages: satellite'
87-
in str(result.stderr)
89+
assert f'protected packages: {protected_pkg}' in str(result.stderr), (
90+
f'Expected protection error for {protected_pkg}, got: {result.stderr}'
8891
)

0 commit comments

Comments
 (0)