Skip to content

Commit

Permalink
dnszone: Add support for check_mode.
Browse files Browse the repository at this point in the history
This patch adds support for check_mode to the dnszone management
module, and provides tests to verify the behavior.
  • Loading branch information
rjeffman committed Jul 8, 2021
1 parent 1a229cb commit 79e2d3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/modules/ipadnszone.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def main():
argument_spec=get_argument_spec(),
mutually_exclusive=[["name", "name_from_ip"]],
required_one_of=[["name", "name_from_ip"]],
supports_check_mode=True,
).ipa_run()


Expand Down
27 changes: 27 additions & 0 deletions tests/dnszone/test_dnszone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@
include_tasks: env_setup.yml

# Tests
- name: Check if zone is present, when in shouldn't be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: not result.changed or result.failed

- name: Check if zone is present again, when in shouldn't be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: not result.changed or result.failed

- name: Ensure zone is present.
ipadnszone:
ipaadmin_password: SomeADMINpassword
Expand All @@ -19,6 +37,15 @@
register: result
failed_when: not result.changed or result.failed

- name: Check if zone is present, when in should be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: result.changed or result.failed

- name: Ensure zone is present, again.
ipadnszone:
ipaadmin_password: SomeADMINpassword
Expand Down

0 comments on commit 79e2d3f

Please sign in to comment.