mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Use custom rpm repo script for dnf testing (#32737)
* Use custom rpm repo script for dnf testing * Switch to a jinja2 test
This commit is contained in:
parent
0ddf092ae3
commit
3c1fb9b547
8 changed files with 790 additions and 626 deletions
|
@ -1,2 +1,3 @@
|
|||
dependencies:
|
||||
- prepare_tests
|
||||
- setup_rpm_repo
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# test code for the yum module
|
||||
# test code for the dnf module
|
||||
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
|
@ -20,7 +20,16 @@
|
|||
# We want to test that for people who don't want to upgrade their systems.
|
||||
|
||||
- include: 'dnf.yml'
|
||||
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int >= 23)
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
||||
- include: 'repo.yml'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
||||
- include: 'dnfinstallroot.yml'
|
||||
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version|int >= 23)
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_distribution_major_version|int >= 23
|
||||
|
|
214
test/integration/targets/dnf/tasks/repo.yml
Normal file
214
test/integration/targets/dnf/tasks/repo.yml
Normal file
|
@ -0,0 +1,214 @@
|
|||
- block:
|
||||
- name: Install foo-1.0-1
|
||||
dnf:
|
||||
name: foo-1.0-1
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-1')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-1 again
|
||||
dnf:
|
||||
name: foo-1.0-1
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-1')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'msg' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Install foo-1:1.0-2
|
||||
dnf:
|
||||
name: "foo-1:1.0-2.{{ ansible_architecture }}"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-2')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Update to the latest foo
|
||||
dnf:
|
||||
name: foo
|
||||
state: latest
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.1-1')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-1 from a file (downgrade)
|
||||
dnf:
|
||||
name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-1')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
|
||||
- name: Remove foo
|
||||
dnf:
|
||||
name: foo
|
||||
state: absent
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-1 from a file
|
||||
dnf:
|
||||
name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-1')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-1 from a file again
|
||||
dnf:
|
||||
name: "{{ repodir }}/foo-1.0-1.{{ ansible_architecture }}.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-1')"
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-2 from a file
|
||||
dnf:
|
||||
name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-2')"
|
||||
|
||||
- name: Verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'results' in dnf_result"
|
||||
# ============================================================================
|
||||
- name: Install foo-1.0-2 from a file again
|
||||
dnf:
|
||||
name: "{{ repodir }}/foo-1.0-2.{{ ansible_architecture }}.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
- "rpm_result.stdout.startswith('foo-1.0-2')"
|
||||
# ============================================================================
|
||||
- name: Remove foo
|
||||
dnf:
|
||||
name: foo
|
||||
state: absent
|
||||
|
||||
- name: Try to install incompatible arch
|
||||
dnf:
|
||||
name: "{{ repodir_ppc64 }}/foo-1.0-1.ppc64.rpm"
|
||||
state: present
|
||||
register: dnf_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Verify installation
|
||||
assert:
|
||||
that:
|
||||
- "rpm_result.rc == 1"
|
||||
- "not dnf_result.changed"
|
||||
- "dnf_result is failed"
|
||||
# ============================================================================
|
||||
always:
|
||||
- name: Clean up
|
||||
yum:
|
||||
name: foo
|
||||
state: absent
|
Loading…
Add table
Add a link
Reference in a new issue