Merge dnf and dnf5 integration tests (#85199)

(cherry picked from commit 01bb9393d7)
pull/85255/head
Martin Krizek 6 months ago committed by Matt Davis
parent a8c68be3b9
commit 603e65d204

@ -896,4 +896,4 @@
- '"No matches were found for the following plugin name patterns while disabling libdnf5 plugins: " in disable_plugin_result.msg'
- '"nonexisting" in enable_plugin_result.msg'
- '"nonexisting" in disable_plugin_result.msg'
when: dnf5|default(false)
when: dnf5

@ -1,3 +1,15 @@
- set_fact:
dnf_log_files:
- /var/log/dnf5.log
when: dnf5
- set_fact:
dnf_log_files:
- /var/log/dnf.log
- /var/log/dnf.rpm.log
- /var/log/dnf.librepo.log
when: not dnf5
- name: Check logging enabled
block:
- name: remove logfiles if exist

@ -1,24 +1,35 @@
# test code for the dnf module
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- set_fact:
dnf5: "{{ (ansible_distribution == 'RedHat' and ansible_distribution_major_version | int > 10) or ansible_distribution == 'Fedora' }}"
- when: dnf5 | default(False)
- when: dnf5
block:
- command: "dnf install -y 'dnf-command(copr)'"
- name: Test against dnf5 nightly build to detect any issues early
command: dnf copr enable -y rpmsoftwaremanagement/dnf-nightly
- name: Ensure module deps are not installed
command: dnf remove -y python3-libdnf5
- name: Test the auto_install_module_deps option
dnf5:
name: sos
auto_install_module_deps: false
register: r
ignore_errors: true
- assert:
that:
- r is failed
- r.msg is contains("Could not import the libdnf5 python module")
# Now the first dnf5 task in the integration tests should auto install python3-libdnf5 as
# auto_install_module_deps is true by default.
- when: ansible_distribution in ['RedHat', 'Fedora']
block:
- block:
- include_tasks: dnf.yml
- include_tasks: skip_broken_and_nobest.yml
- block:
@ -33,15 +44,14 @@
- include_tasks: logging.yml
- include_tasks: cacheonly.yml
- include_tasks: multilib.yml
when: ansible_distribution in ['Fedora', 'RedHat']
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include_tasks: dnfreleasever.yml
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include_tasks: dnfreleasever.yml
when: ansible_distribution == 'Fedora'
- when:
- when:
- ansible_distribution == 'RedHat'
- not dnf5|default(false)
- ansible_distribution_major_version | int == 9
block:
# FUTURE - look at including AppStream support in our local repo
- name: list modules

@ -11,7 +11,7 @@
content: |
x86_64
dest: /etc/dnf/vars/arch
when: dnf5|default(false)
when: dnf5
- block:
- name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package

@ -128,7 +128,7 @@
register: res
- vars:
pkg_state: '{{ "Downgrade:" if dnf5|default(false) else "Installed:" }}'
pkg_state: '{{ "Downgrade:" if dnf5 else "Installed:" }}'
assert:
that:
- res is changed
@ -181,7 +181,7 @@
register: res
- vars:
pkg_state: '{{ "Downgrade:" if dnf5|default(false) else "Installed:" }}'
pkg_state: '{{ "Downgrade:" if dnf5 else "Installed:" }}'
assert:
that:
- res is changed
@ -309,7 +309,7 @@
# skip_broken and skip_unavailable.
# TODO: for this test to pass on dnf5 the skip_unavailable option would have to be
# added to the dnf5 module and used here instead of skip_broken.
when: not dnf5|default(false)
when: not dnf5
always:
- name: Remove all test packages installed

@ -1,4 +0,0 @@
dnf_log_files:
- /var/log/dnf.log
- /var/log/dnf.rpm.log
- /var/log/dnf.librepo.log

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/freebsd
skip/macos
context/target
needs/target/dnf

@ -1,34 +0,0 @@
- hosts: localhost
tasks:
- block:
- command: "dnf install -y 'dnf-command(copr)'"
- name: Test against dnf5 nightly build to detect any issues early
command: dnf copr enable -y rpmsoftwaremanagement/dnf-nightly
- name: Ensure module deps are not installed
command: dnf remove -y python3-libdnf5
- name: Test the auto_install_module_deps option
dnf5:
name: sos
auto_install_module_deps: false
register: r
ignore_errors: true
- assert:
that:
- r is failed
- r.msg is contains("Could not import the libdnf5 python module")
# Now the first dnf5 task in the dnf role should auto install python3-libdnf5 as
# auto_install_module_deps is true by default.
- include_role:
name: dnf
vars:
dnf5: true
dnf_log_files:
- /var/log/dnf5.log
when: ansible_distribution == 'Fedora'
module_defaults:
dnf:
use_backend: dnf5

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ux
export ANSIBLE_ROLES_PATH=../
ansible-playbook playbook.yml "$@"
Loading…
Cancel
Save