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' - '"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 enable_plugin_result.msg'
- '"nonexisting" in disable_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 - name: Check logging enabled
block: block:
- name: remove logfiles if exist - name: remove logfiles if exist

@ -1,64 +1,74 @@
# test code for the dnf module
# (c) 2014, James Tanner <tanner.jc@gmail.com> # (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 - set_fact:
# dnf5: "{{ (ansible_distribution == 'RedHat' and ansible_distribution_major_version | int > 10) or ansible_distribution == 'Fedora' }}"
# 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/>.
- when: dnf5 | default(False) - when: dnf5
block: block:
- block: - command: "dnf install -y 'dnf-command(copr)'"
- include_tasks: dnf.yml - name: Test against dnf5 nightly build to detect any issues early
- include_tasks: skip_broken_and_nobest.yml command: dnf copr enable -y rpmsoftwaremanagement/dnf-nightly
- block:
- include_tasks: filters.yml
- include_tasks: filters_check_mode.yml
tags:
- filters
- include_tasks: gpg.yml
- include_tasks: repo.yml
- include_tasks: dnf_group_remove.yml
- include_tasks: dnfinstallroot.yml
- 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) - name: Ensure module deps are not installed
- include_tasks: dnfreleasever.yml command: dnf remove -y python3-libdnf5
when: ansible_distribution == 'Fedora'
- when: - name: Test the auto_install_module_deps option
- ansible_distribution == 'RedHat' dnf5:
- not dnf5|default(false) name: sos
block: auto_install_module_deps: false
# FUTURE - look at including AppStream support in our local repo register: r
- name: list modules ignore_errors: true
command: dnf module list -q
register: module_list
# A module that only has a single version - assert:
- name: Find a module that meets our testing needs that:
set_fact: - r is failed
astream_name: '@{{ module.name }}:{{ module.version }}/{{ module.profile }}' - r.msg is contains("Could not import the libdnf5 python module")
astream_name_no_stream: '@{{ module.name }}/{{ module.profile }}'
vars:
module: '{{ module_list.stdout|get_first_single_version_module }}'
- include_tasks: modularity.yml # Now the first dnf5 task in the integration tests should auto install python3-libdnf5 as
tags: # auto_install_module_deps is true by default.
- dnf_modularity
rescue: - when: ansible_distribution in ['RedHat', 'Fedora']
# Just in case something crazy happens when listing or parsing modules block:
- meta: noop - include_tasks: dnf.yml
- include_tasks: skip_broken_and_nobest.yml
- block:
- include_tasks: filters.yml
- include_tasks: filters_check_mode.yml
tags:
- filters
- include_tasks: gpg.yml
- include_tasks: repo.yml
- include_tasks: dnf_group_remove.yml
- include_tasks: dnfinstallroot.yml
- include_tasks: logging.yml
- include_tasks: cacheonly.yml
- include_tasks: multilib.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:
- ansible_distribution == 'RedHat'
- ansible_distribution_major_version | int == 9
block:
# FUTURE - look at including AppStream support in our local repo
- name: list modules
command: dnf module list -q
register: module_list
# A module that only has a single version
- name: Find a module that meets our testing needs
set_fact:
astream_name: '@{{ module.name }}:{{ module.version }}/{{ module.profile }}'
astream_name_no_stream: '@{{ module.name }}/{{ module.profile }}'
vars:
module: '{{ module_list.stdout|get_first_single_version_module }}'
- include_tasks: modularity.yml
tags:
- dnf_modularity
rescue:
# Just in case something crazy happens when listing or parsing modules
- meta: noop

@ -11,7 +11,7 @@
content: | content: |
x86_64 x86_64
dest: /etc/dnf/vars/arch dest: /etc/dnf/vars/arch
when: dnf5|default(false) when: dnf5
- block: - block:
- name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package - 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 register: res
- vars: - vars:
pkg_state: '{{ "Downgrade:" if dnf5|default(false) else "Installed:" }}' pkg_state: '{{ "Downgrade:" if dnf5 else "Installed:" }}'
assert: assert:
that: that:
- res is changed - res is changed
@ -181,7 +181,7 @@
register: res register: res
- vars: - vars:
pkg_state: '{{ "Downgrade:" if dnf5|default(false) else "Installed:" }}' pkg_state: '{{ "Downgrade:" if dnf5 else "Installed:" }}'
assert: assert:
that: that:
- res is changed - res is changed
@ -309,7 +309,7 @@
# skip_broken and skip_unavailable. # skip_broken and skip_unavailable.
# TODO: for this test to pass on dnf5 the skip_unavailable option would have to be # 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. # added to the dnf5 module and used here instead of skip_broken.
when: not dnf5|default(false) when: not dnf5
always: always:
- name: Remove all test packages installed - 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