mirror of https://github.com/ansible/ansible.git
Use custom rpm repo script for dnf testing (#32737)
* Use custom rpm repo script for dnf testing * Switch to a jinja2 testpull/33133/head
parent
0ddf092ae3
commit
3c1fb9b547
@ -1,2 +1,3 @@
|
||||
dependencies:
|
||||
- prepare_tests
|
||||
- setup_rpm_repo
|
||||
|
@ -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
|
@ -0,0 +1,63 @@
|
||||
- block:
|
||||
- name: Install epel repo which is missing on rhel-7 and is needed for rpmfluff
|
||||
package:
|
||||
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
when:
|
||||
- ansible_distribution in ['RedHat']
|
||||
|
||||
- name: Install rpmfluff and deps
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- python-rpmfluff
|
||||
- createrepo_c
|
||||
- createrepo # used by el6 version of rpmfluff
|
||||
|
||||
- name: Copy script for creating a repo
|
||||
copy:
|
||||
src: create-repo.py
|
||||
dest: /tmp/create-repo.py
|
||||
mode: 0755
|
||||
|
||||
- name: Create RPMs and put them into a repo
|
||||
shell: "python /tmp/create-repo.py {{ ansible_architecture }}"
|
||||
register: repo
|
||||
|
||||
- set_fact:
|
||||
repodir: "{{ repo.stdout_lines[-1] }}"
|
||||
|
||||
- name: Install the repo
|
||||
yum_repository:
|
||||
name: "fake-{{ ansible_architecture }}"
|
||||
description: "fake-{{ ansible_architecture }}"
|
||||
baseurl: "file://{{ repodir }}"
|
||||
gpgcheck: no
|
||||
|
||||
- name: Create RPMs and put them into a repo (i686)
|
||||
shell: "python /tmp/create-repo.py i686"
|
||||
register: repo_i686
|
||||
|
||||
- set_fact:
|
||||
repodir_i686: "{{ repo_i686.stdout_lines[-1] }}"
|
||||
|
||||
- name: Install the repo (i686)
|
||||
yum_repository:
|
||||
name: "fake-i686"
|
||||
description: "fake-i686"
|
||||
baseurl: "file://{{ repodir_i686 }}"
|
||||
gpgcheck: no
|
||||
|
||||
- name: Create RPMs and put them into a repo (ppc64)
|
||||
shell: "python /tmp/create-repo.py ppc64"
|
||||
register: repo_ppc64
|
||||
|
||||
- set_fact:
|
||||
repodir_ppc64: "{{ repo_ppc64.stdout_lines[-1] }}"
|
||||
|
||||
- name: Install the repo (ppc64)
|
||||
yum_repository:
|
||||
name: "fake-ppc64"
|
||||
description: "fake-ppc64"
|
||||
baseurl: "file://{{ repodir_ppc64 }}"
|
||||
gpgcheck: no
|
||||
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']
|
@ -1,2 +1,4 @@
|
||||
destructive
|
||||
posix/ci/group1
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
|
@ -1,2 +1,3 @@
|
||||
dependencies:
|
||||
- prepare_tests
|
||||
- setup_rpm_repo
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue