forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add intentional tests for dnf group remove (ansible#81739)
* Add intentional tests for dnf group remove * Copy tests from yum
- Loading branch information
Showing
3 changed files
with
148 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
test/integration/targets/dnf/tasks/dnf_group_remove.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
- name: install a group to test and dnf-utils | ||
dnf: | ||
name: "{{ pkgs }}" | ||
state: present | ||
vars: | ||
pkgs: | ||
- "@Custom Group" | ||
- dnf-utils | ||
|
||
- name: check mode remove the group | ||
dnf: | ||
name: "@Custom Group" | ||
state: absent | ||
check_mode: yes | ||
register: dnf_result | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: remove the group | ||
dnf: | ||
name: "@Custom Group" | ||
state: absent | ||
register: dnf_result | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "dnf_result.rc == 0" | ||
- "dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'msg' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: remove the group again | ||
dnf: | ||
name: "@Custom Group" | ||
state: absent | ||
register: dnf_result | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "not dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'msg' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: check mode remove the group again | ||
dnf: | ||
name: "@Custom Group" | ||
state: absent | ||
check_mode: yes | ||
register: dnf_result | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "not dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: install a group and a package to test | ||
dnf: | ||
name: "@Custom Group,sos" | ||
state: present | ||
register: dnf_output | ||
|
||
- name: check mode remove the group along with the package | ||
dnf: | ||
name: "@Custom Group,sos" | ||
state: absent | ||
register: dnf_result | ||
check_mode: yes | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: remove the group along with the package | ||
dnf: | ||
name: "@Custom Group,sos" | ||
state: absent | ||
register: dnf_result | ||
|
||
- name: verify changed | ||
assert: | ||
that: | ||
- "dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'msg' in dnf_result" | ||
- "'results' in dnf_result" | ||
|
||
- name: check mode remove the group along with the package | ||
dnf: | ||
name: "@Custom Group,sos" | ||
state: absent | ||
register: dnf_result | ||
check_mode: yes | ||
|
||
- name: verify not changed | ||
assert: | ||
that: | ||
- "not dnf_result.changed" | ||
|
||
- name: verify dnf module outputs | ||
assert: | ||
that: | ||
- "'changed' in dnf_result" | ||
- "'results' in dnf_result" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters