Fix dnf integration test issues. (#51251)

* update/enable rhel8 beta integration tests for yum and dnf

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix typo in conditional for dnf/tasks/main.yml

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix var scoping for environment checks

Signed-off-by: Adam Miller <admiller@redhat.com>

* Disable install via path on RHEL.
pull/51253/head
Matt Clay 6 years ago committed by GitHub
parent 73e7e663c6
commit a20d0d1afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,4 +2,3 @@ destructive
shippable/posix/group1 shippable/posix/group1
skip/freebsd skip/freebsd
skip/osx skip/osx
skip/rhel8.0

@ -84,8 +84,8 @@
- "not dnf_result.changed" - "not dnf_result.changed"
# Multiple packages # Multiple packages
- name: uninstall sos and sharutils - name: uninstall sos and pciutils
dnf: name=sos,sharutils state=removed dnf: name=sos,pciutils state=removed
register: dnf_result register: dnf_result
- name: check sos with rpm - name: check sos with rpm
@ -93,19 +93,19 @@
failed_when: False failed_when: False
register: rpm_sos_result register: rpm_sos_result
- name: check sharutils with rpm - name: check pciutils with rpm
shell: rpm -q sharutils shell: rpm -q pciutils
failed_when: False failed_when: False
register: rpm_sharutils_result register: rpm_pciutils_result
- name: verify packages installed - name: verify packages installed
assert: assert:
that: that:
- "rpm_sos_result.rc != 0" - "rpm_sos_result.rc != 0"
- "rpm_sharutils_result.rc != 0" - "rpm_pciutils_result.rc != 0"
- name: install sos and sharutils as comma separated - name: install sos and pciutils as comma separated
dnf: name=sos,sharutils state=present dnf: name=sos,pciutils state=present
register: dnf_result register: dnf_result
- name: check sos with rpm - name: check sos with rpm
@ -113,10 +113,10 @@
failed_when: False failed_when: False
register: rpm_sos_result register: rpm_sos_result
- name: check sharutils with rpm - name: check pciutils with rpm
shell: rpm -q sharutils shell: rpm -q pciutils
failed_when: False failed_when: False
register: rpm_sharutils_result register: rpm_pciutils_result
- name: verify packages installed - name: verify packages installed
assert: assert:
@ -124,17 +124,17 @@
- "not dnf_result.failed | default(False)" - "not dnf_result.failed | default(False)"
- "dnf_result.changed" - "dnf_result.changed"
- "rpm_sos_result.rc == 0" - "rpm_sos_result.rc == 0"
- "rpm_sharutils_result.rc == 0" - "rpm_pciutils_result.rc == 0"
- name: uninstall sos and sharutils - name: uninstall sos and pciutils
dnf: name=sos,sharutils state=removed dnf: name=sos,pciutils state=removed
register: dnf_result register: dnf_result
- name: install sos and sharutils as list - name: install sos and pciutils as list
dnf: dnf:
name: name:
- sos - sos
- sharutils - pciutils
state: present state: present
register: dnf_result register: dnf_result
@ -143,10 +143,10 @@
failed_when: False failed_when: False
register: rpm_sos_result register: rpm_sos_result
- name: check sharutils with rpm - name: check pciutils with rpm
shell: rpm -q sharutils shell: rpm -q pciutils
failed_when: False failed_when: False
register: rpm_sharutils_result register: rpm_pciutils_result
- name: verify packages installed - name: verify packages installed
assert: assert:
@ -154,17 +154,17 @@
- "not dnf_result.failed | default(False)" - "not dnf_result.failed | default(False)"
- "dnf_result.changed" - "dnf_result.changed"
- "rpm_sos_result.rc == 0" - "rpm_sos_result.rc == 0"
- "rpm_sharutils_result.rc == 0" - "rpm_pciutils_result.rc == 0"
- name: uninstall sos and sharutils - name: uninstall sos and pciutils
dnf: dnf:
name: "sos,sharutils" name: "sos,pciutils"
state: removed state: removed
register: dnf_result register: dnf_result
- name: install sos and sharutils as comma separated with spaces - name: install sos and pciutils as comma separated with spaces
dnf: dnf:
name: "sos, sharutils" name: "sos, pciutils"
state: present state: present
register: dnf_result register: dnf_result
@ -174,9 +174,9 @@
register: rpm_sos_result register: rpm_sos_result
- name: check sos with rpm - name: check sos with rpm
shell: rpm -q sharutils shell: rpm -q pciutils
failed_when: False failed_when: False
register: rpm_sharutils_result register: rpm_pciutils_result
- name: verify packages installed - name: verify packages installed
assert: assert:
@ -184,13 +184,13 @@
- "not dnf_result.failed | default(False)" - "not dnf_result.failed | default(False)"
- "dnf_result.changed" - "dnf_result.changed"
- "rpm_sos_result.rc == 0" - "rpm_sos_result.rc == 0"
- "rpm_sharutils_result.rc == 0" - "rpm_pciutils_result.rc == 0"
- name: uninstall sos and sharutils - name: uninstall sos and pciutils
dnf: dnf:
name: name:
- sos - sos
- sharutils - pciutils
state: removed state: removed
- name: install non-existent rpm - name: install non-existent rpm
@ -267,110 +267,221 @@
# GROUP INSTALL # GROUP INSTALL
# Using 'Books and Guides' because it is only 5 packages and a 7.3 M download on Fedora 26. # Using 'Books and Guides' because it is only 5 packages and a 7.3 M download on Fedora 26.
# It also doesn't install anything that will tamper with our Python environment. # It also doesn't install anything that will tamper with our Python environment.
- name: install Books and Guides group - name: install Books and Guides group block (Fedora)
dnf: block:
name: "@Books and Guides" - name: install Books and Guides group
state: present dnf:
register: dnf_result name: "@Books and Guides"
state: present
register: dnf_result
- name: verify installation of the group - name: verify installation of the group
assert: assert:
that: that:
- "not dnf_result.failed | default(False)" - "not dnf_result.failed | default(False)"
- "dnf_result.changed" - "dnf_result.changed"
- name: verify dnf module outputs - name: verify dnf module outputs
assert: assert:
that: that:
- "'changed' in dnf_result" - "'changed' in dnf_result"
- "'results' in dnf_result" - "'results' in dnf_result"
- name: install the group again - name: install the group again
dnf: dnf:
name: "@Books and Guides" name: "@Books and Guides"
state: present state: present
register: dnf_result register: dnf_result
- name: verify nothing changed - name: verify nothing changed
assert: assert:
that: that:
- "not dnf_result.changed" - "not dnf_result.changed"
- name: verify dnf module outputs - name: verify dnf module outputs
assert: assert:
that: that:
- "'changed' in dnf_result" - "'changed' in dnf_result"
- "'msg' in dnf_result" - "'msg' in dnf_result"
- name: verify that bc is not installed - name: verify that bc is not installed
dnf: dnf:
name: bc name: bc
state: absent state: absent
- name: install the group again but also with a package that is not yet installed - name: install the group again but also with a package that is not yet installed
dnf: dnf:
name: name:
- "@Books and Guides" - "@Books and Guides"
- bc - bc
state: present state: present
register: dnf_result register: dnf_result
- name: verify bc is installed - name: verify bc is installed
assert: assert:
that: that:
- "dnf_result.changed" - "dnf_result.changed"
- name: verify dnf module outputs - name: verify dnf module outputs
assert: assert:
that: that:
- "'changed' in dnf_result" - "'changed' in dnf_result"
- "'results' in dnf_result" - "'results' in dnf_result"
- name: try to install the group again, with --check to check 'changed' - name: try to install the group again, with --check to check 'changed'
dnf: dnf:
name: "@Books and Guides" name: "@Books and Guides"
state: present state: present
check_mode: yes check_mode: yes
register: dnf_result register: dnf_result
- name: verify nothing changed - name: verify nothing changed
assert: assert:
that: that:
- "not dnf_result.changed" - "not dnf_result.changed"
- name: verify dnf module outputs - name: verify dnf module outputs
assert: assert:
that: that:
- "'changed' in dnf_result" - "'changed' in dnf_result"
- "'msg' in dnf_result" - "'msg' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved # cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell: 'dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"' - shell: 'dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"'
register: shell_dnf_result register: shell_dnf_result
# GROUP UPGRADE - this will go to the same method as group install # GROUP UPGRADE - this will go to the same method as group install
# but through group_update - it is its invocation we're testing here # but through group_update - it is its invocation we're testing here
# see commit 119c9e5d6eb572c4a4800fbe8136095f9063c37b # see commit 119c9e5d6eb572c4a4800fbe8136095f9063c37b
- name: install latest Books and Guides - name: install latest Books and Guides
dnf: dnf:
name: "@Books and Guides" name: "@Books and Guides"
state: latest state: latest
register: dnf_result register: dnf_result
- name: verify installation of the group - name: verify installation of the group
assert: assert:
that: that:
- "not dnf_result.failed | default(False)" - "not dnf_result.failed | default(False)"
- "dnf_result.changed" - "dnf_result.changed"
- name: verify dnf module outputs - name: verify dnf module outputs
assert: assert:
that: that:
- "'changed' in dnf_result" - "'changed' in dnf_result"
- "'results' in dnf_result" - "'results' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell: dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"
when: ansible_distribution == "Fedora"
- name: install RPM Development Tools group block (rhel8 beta)
block:
- name: install RPM Development Tools group
dnf:
name: "@RPM Development Tools"
state: present
register: dnf_result
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved - name: verify installation of the group
- shell: dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides" assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
- name: install the group again
dnf:
name: "@RPM Development Tools"
state: present
register: dnf_result
- name: verify nothing changed
assert:
that:
- "not dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'msg' in dnf_result"
- name: verify that bc is not installed
dnf:
name: bc
state: absent
- name: install the group again but also with a package that is not yet installed
dnf:
name:
- "@RPM Development Tools"
- bc
state: present
register: dnf_result
- name: verify bc is installed
assert:
that:
- "dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
- name: try to install the group again, with --check to check 'changed'
dnf:
name: "@RPM Development Tools"
state: present
check_mode: yes
register: dnf_result
- name: verify nothing changed
assert:
that:
- "not dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'msg' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell: 'dnf -y group install "RPM Development Tools" && dnf -y group remove "RPM Development Tools"'
register: shell_dnf_result
# 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
- name: install latest RPM Development Tools
dnf:
name: "@RPM Development Tools"
state: latest
register: dnf_result
- name: verify installation of the group
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell: dnf -y group install "RPM Development Tools" && dnf -y group remove "RPM Development Tools"
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 8
- name: try to install non existing group - name: try to install non existing group
dnf: dnf:
@ -440,30 +551,49 @@
command: dnf install --allowerasing -y coreutils command: dnf install --allowerasing -y coreutils
changed_when: '"Nothing to do" not in coreutils_install.stdout' changed_when: '"Nothing to do" not in coreutils_install.stdout'
register: coreutils_install register: coreutils_install
when: ansible_distribution == "Fedora"
- block: - name: install Web Server environment block (Fedora)
block:
- name: install Web Server environment - name: install Web Server environment
dnf: dnf:
name: "@Web Server" name: "@Web Server"
state: latest state: latest
register: dnf_result register: dnf_result
- name: verify installation of the environment
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
always: always:
- name: reinstall coreutils-single if coreutils was installed - name: reinstall coreutils-single if coreutils was installed
command: dnf install --allowerasing -y coreutils-single command: dnf install --allowerasing -y coreutils-single
when: coreutils_install is changed when: coreutils_install is changed
when: ansible_distribution == "Fedora"
- name: verify installation of the environment - name: install Server environment block (rhel8 beta)
assert: block:
that: - name: install Server environment
- "not dnf_result.failed | default(False)" dnf:
- "dnf_result.changed" name: "@Server"
state: latest
- name: verify dnf module outputs register: dnf_result
assert: - name: verify installation of the environment
that: assert:
- "'changed' in dnf_result" that:
- "'results' in dnf_result" - "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name: verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
when: ansible_distribution == "RedHat"
# https://github.com/ansible/ansible/issues/39704 # https://github.com/ansible/ansible/issues/39704
- name: install non-existent rpm, state=latest - name: install non-existent rpm, state=latest
@ -685,3 +815,5 @@
assert: assert:
that: that:
- "'vim-minimal' in rpm_output.stdout" - "'vim-minimal' in rpm_output.stdout"
when:
- ansible_distribution == 'Fedora'

@ -21,25 +21,21 @@
- include: 'dnf.yml' - include: 'dnf.yml'
when: when:
- ansible_distribution == 'Fedora' - (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- ansible_distribution_major_version|int >= 23
- include: 'repo.yml' - include: 'repo.yml'
when: when:
- ansible_distribution == 'Fedora' - (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- ansible_distribution_major_version|int >= 23
- include: 'dnfinstallroot.yml' - include: 'dnfinstallroot.yml'
when: when:
- ansible_distribution == 'Fedora' - (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- ansible_distribution_major_version|int >= 23
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include: 'dnfreleasever.yml' - include: 'dnfreleasever.yml'
when: when:
- ansible_distribution == 'Fedora' - ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 23
- ansible_distribution_major_version|int >= 23
- import_tasks: 'modularity.yml' - import_tasks: 'modularity.yml'
when: when:
- ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29 - (ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 29) or (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8)
- ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 8

@ -37,7 +37,7 @@
- name: uninstall "@postgresql:9.6/client" module again - name: uninstall "@postgresql:9.6/client" module again
dnf: dnf:
name: "@postgresql:9.6/client" name: "@postgresql:9.6/client"
state: install state: absent
register: dnf_result register: dnf_result
- name: verify uninstallation of "@postgresql:9.6/client" module again - name: verify uninstallation of "@postgresql:9.6/client" module again

Loading…
Cancel
Save