Add intentional tests for dnf install rpm when higher version is installed (#81740)

* Add intentional tests for dnf install rpm when higher version is installed

* ci_complete ci_coverage
pull/81795/head
Martin Krizek 1 year ago committed by GitHub
parent 68ab02a504
commit 60c9660952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- dnf5 - respect ``allow_downgrade`` when installing packages directly from rpm files

@ -357,9 +357,15 @@ def is_installed(base, spec):
def is_newer_version_installed(base, spec):
# FIXME investigate whether this function can be replaced by dnf5's allow_downgrade option
if "/" in spec:
spec = spec.split("/")[-1]
if spec.endswith(".rpm"):
spec = spec[:-4]
try:
spec_nevra = next(iter(libdnf5.rpm.Nevra.parse(spec)))
except RuntimeError:
except (RuntimeError, StopIteration):
return False
spec_name = spec_nevra.get_name()
v = spec_nevra.get_version()

@ -101,6 +101,30 @@
that:
- "'results' in dnf_result"
# ============================================================================
- name: Install dinginessentail-1.0-1 from a file (higher version is already installed)
dnf:
name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm"
state: present
disable_gpg_check: True
register: dnf_result
- name: Check dinginessentail with rpm
shell: rpm -q dinginessentail
register: rpm_result
- name: Verify installation
assert:
that:
- "not dnf_result.changed"
- "rpm_result.stdout.startswith('dinginessentail-1.1-1')"
- name: Verify dnf module outputs
assert:
that:
- "'msg' in dnf_result"
- "'rc' in dnf_result"
- "'results' in dnf_result"
# ============================================================================
- name: Install dinginessentail-1.0-1 from a file (downgrade)
dnf:
name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm"

Loading…
Cancel
Save