diff options
author | Martin Krizek <martin.krizek@gmail.com> | 2023-03-31 15:51:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 15:51:48 +0200 |
commit | a81b787a0510098686cf0263dd8b90bd0189e951 (patch) | |
tree | 230b7c5990c5074677f94137851a8520cfc744bb /test/integration/targets | |
parent | 666188892ed0833e87803a3e80c58923e4cd6bca (diff) | |
download | ansible-a81b787a0510098686cf0263dd8b90bd0189e951.tar.gz |
Add new dnf5 module (#80272)
Diffstat (limited to 'test/integration/targets')
-rw-r--r-- | test/integration/targets/dnf/tasks/dnf.yml | 34 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/main.yml | 7 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml | 3 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/test_sos_removal.yml | 4 | ||||
-rw-r--r-- | test/integration/targets/dnf5/aliases | 6 | ||||
-rw-r--r-- | test/integration/targets/dnf5/playbook.yml | 19 | ||||
-rwxr-xr-x | test/integration/targets/dnf5/runme.sh | 5 |
7 files changed, 63 insertions, 15 deletions
diff --git a/test/integration/targets/dnf/tasks/dnf.yml b/test/integration/targets/dnf/tasks/dnf.yml index ec1c36f860..e6343e98f0 100644 --- a/test/integration/targets/dnf/tasks/dnf.yml +++ b/test/integration/targets/dnf/tasks/dnf.yml @@ -224,7 +224,7 @@ - assert: that: - dnf_result is success - - dnf_result.results|length == 2 + - dnf_result.results|length >= 2 - "dnf_result.results[0].startswith('Removed: ')" - "dnf_result.results[1].startswith('Removed: ')" @@ -427,6 +427,10 @@ - shell: 'dnf -y group install "Custom Group" && dnf -y group remove "Custom Group"' register: shell_dnf_result +- dnf: + name: "@Custom Group" + state: absent + # GROUP UPGRADE - this will go to the same method as group install # but through group_update - it is its invocation we're testing here # see commit 119c9e5d6eb572c4a4800fbe8136095f9063c37b @@ -446,6 +450,10 @@ # cleanup until https://github.com/ansible/ansible/issues/27377 is resolved - shell: dnf -y group install "Custom Group" && dnf -y group remove "Custom Group" +- dnf: + name: "@Custom Group" + state: absent + - name: try to install non existing group dnf: name: "@non-existing-group" @@ -522,6 +530,7 @@ - dnf_result is changed - "'results' in dnf_result" - landsidescalping_result.rc == 0 + when: not dnf5|default('false') # Fedora 28 (DNF 2) does not support this, just remove the package itself - name: remove landsidescalping package on Fedora 28 @@ -551,30 +560,35 @@ - "'No package non-existent-rpm available' in dnf_result['failures'][0]" - "'Failed to install some of the specified packages' in dnf_result['msg']" -- name: use latest to install httpd +- name: ensure sos isn't installed dnf: - name: httpd + name: sos + state: absent + +- name: use latest to install sos + dnf: + name: sos state: latest register: dnf_result -- name: verify httpd was installed +- name: verify sos was installed assert: that: - - "'changed' in dnf_result" + - dnf_result is changed -- name: uninstall httpd +- name: uninstall sos dnf: - name: httpd + name: sos state: removed -- name: update httpd only if it exists +- name: update sos only if it exists dnf: - name: httpd + name: sos state: latest update_only: yes register: dnf_result -- name: verify httpd not installed +- name: verify sos not installed assert: that: - "not dnf_result is changed" diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml index 66a171ac94..b84e3389bc 100644 --- a/test/integration/targets/dnf/tasks/main.yml +++ b/test/integration/targets/dnf/tasks/main.yml @@ -62,6 +62,7 @@ - astream_name is defined - (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('29', '>=')) or (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) + - not dnf5|default('false') tags: - dnf_modularity @@ -70,5 +71,7 @@ (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) - include_tasks: cacheonly.yml - when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or - (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) + when: + - (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or + (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) + - not dnf5|default('false') diff --git a/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml b/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml index 503cb4c3e6..f54c0a83d9 100644 --- a/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml +++ b/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml @@ -240,7 +240,8 @@ - name: Do an "upgrade" to an older version of broken-a, allow_downgrade=false dnf: name: - - broken-a-1.2.3-1* + #- broken-a-1.2.3-1* + - broken-a-1.2.3-1.el7.x86_64 state: latest allow_downgrade: false check_mode: true diff --git a/test/integration/targets/dnf/tasks/test_sos_removal.yml b/test/integration/targets/dnf/tasks/test_sos_removal.yml index 40ceb62bf4..5e161dbb2e 100644 --- a/test/integration/targets/dnf/tasks/test_sos_removal.yml +++ b/test/integration/targets/dnf/tasks/test_sos_removal.yml @@ -15,5 +15,5 @@ that: - sos_rm is successful - sos_rm is changed - - "'Removed: sos-{{ sos_version }}-{{ sos_release }}' in sos_rm.results[0]" - - sos_rm.results|length == 1 + - sos_rm.results|select("contains", "Removed: sos-{{ sos_version }}-{{ sos_release }}")|length > 0 + - sos_rm.results|length > 0 diff --git a/test/integration/targets/dnf5/aliases b/test/integration/targets/dnf5/aliases new file mode 100644 index 0000000000..4baf6e62c6 --- /dev/null +++ b/test/integration/targets/dnf5/aliases @@ -0,0 +1,6 @@ +destructive +shippable/posix/group1 +skip/freebsd +skip/macos +context/target +needs/target/dnf diff --git a/test/integration/targets/dnf5/playbook.yml b/test/integration/targets/dnf5/playbook.yml new file mode 100644 index 0000000000..16dfd22e36 --- /dev/null +++ b/test/integration/targets/dnf5/playbook.yml @@ -0,0 +1,19 @@ +- hosts: localhost + tasks: + - block: + - command: "dnf install -y 'dnf-command(copr)'" + - command: dnf copr enable -y rpmsoftwaremanagement/dnf5-unstable + - command: dnf install -y python3-libdnf5 + + - include_role: + name: dnf + vars: + dnf5: true + dnf_log_files: + - /var/log/dnf5.log + when: + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version is version('37', '>=') + module_defaults: + dnf: + use_backend: dnf5 diff --git a/test/integration/targets/dnf5/runme.sh b/test/integration/targets/dnf5/runme.sh new file mode 100755 index 0000000000..51a6bf4524 --- /dev/null +++ b/test/integration/targets/dnf5/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -ux +export ANSIBLE_ROLES_PATH=../ +ansible-playbook playbook.yml "$@" |