diff --git a/test/integration/targets/dnf/tasks/dnf.yml b/test/integration/targets/dnf/tasks/dnf.yml index 8415a12be3..bfbd7a3ca9 100644 --- a/test/integration/targets/dnf/tasks/dnf.yml +++ b/test/integration/targets/dnf/tasks/dnf.yml @@ -264,6 +264,60 @@ - "'changed' in dnf_result" - "'results' in dnf_result" +- name: install the group again + dnf: + name: "@Books and Guides" + 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: install the group again but also with a package that is not yet installed + dnf: + name: + - "@Books and Guides" + - 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: "@Books and Guides" + 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 "Books and Guides" && dnf -y group remove "Books and Guides" @@ -292,3 +346,60 @@ # 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" + +- name: try to install non existing group + dnf: + name: "@non-existing-group" + state: present + register: dnf_result + ignore_errors: True + +- name: verify installation of the non existing group failed + assert: + that: + - "not dnf_result.changed" + - "dnf_result|failed" + +- name: verify dnf module outputs + assert: + that: + - "'changed' in dnf_result" + - "'msg' in dnf_result" + +- name: try to install non existing file + dnf: + name: /tmp/non-existing-1.0.0.fc26.noarch.rpm + state: present + register: dnf_result + ignore_errors: yes + +- name: verify installation failed + assert: + that: + - "dnf_result|failed" + - "not dnf_result.changed" + +- name: verify dnf module outputs + assert: + that: + - "'changed' in dnf_result" + - "'msg' in dnf_result" + +- name: try to install from non existing url + dnf: + name: http://non-existing.com/non-existing-1.0.0.fc26.noarch.rpm + state: present + register: dnf_result + ignore_errors: yes + +- name: verify installation failed + assert: + that: + - "dnf_result|failed" + - "not dnf_result.changed" + +- name: verify dnf module outputs + assert: + that: + - "'changed' in dnf_result" + - "'msg' in dnf_result"