mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
[28017] Integration tests for win_rabbitmq_plugin (#28118)
* Check registry to find RabbitMQ installation path * Integration tests for win_rabbitmq_plugin * Added himself to BOTMETA.yml * Skipped running tests on Windows 2008 SP2
This commit is contained in:
parent
468e71bf71
commit
1c958af88b
5 changed files with 184 additions and 5 deletions
1
test/integration/targets/win_rabbitmq_plugin/aliases
Normal file
1
test/integration/targets/win_rabbitmq_plugin/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
windows/ci/group3
|
|
@ -0,0 +1,7 @@
|
|||
# Setup action creates ansible_distribution_version variable
|
||||
- action: setup
|
||||
|
||||
- include_tasks: tasks/tests.yml
|
||||
# Works on windows >= Windows 7/Windows Server 2008 R2
|
||||
# See https://github.com/ansible/ansible/pull/28118#issuecomment-323684042 for additional info.
|
||||
when: ansible_distribution_version | version_compare('6.1', '>=')
|
134
test/integration/targets/win_rabbitmq_plugin/tasks/tests.yml
Normal file
134
test/integration/targets/win_rabbitmq_plugin/tasks/tests.yml
Normal file
|
@ -0,0 +1,134 @@
|
|||
- name: Ensure RabbitMQ installed
|
||||
win_chocolatey:
|
||||
name: rabbitmq
|
||||
state: present
|
||||
|
||||
- name: Ensure that rabbitmq_management plugin disabled
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: disabled
|
||||
|
||||
- name: Enable rabbitmq_management plugin in check mode
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: enabled
|
||||
check_mode: yes
|
||||
register: enable_plugin_in_check_mode
|
||||
|
||||
- name: Check that enabling plugin in check mode succeeds with a change
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin_in_check_mode.changed == true
|
||||
|
||||
- name: Enable rabbitmq_management plugin in check mode again
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: enabled
|
||||
check_mode: yes
|
||||
register: enable_plugin_in_check_mode_again
|
||||
|
||||
- name: Check that enabling plugin in check mode does not make changes
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin_in_check_mode_again.changed == true
|
||||
|
||||
- name: Enable rabbitmq_management plugin
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: enabled
|
||||
register: enable_plugin
|
||||
|
||||
- name: Check that enabling plugin succeeds with a change
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin.changed == true
|
||||
- enable_plugin.enabled == ['rabbitmq_management']
|
||||
|
||||
- name: Enable enabled rabbitmq_management plugin
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: enabled
|
||||
register: enable_plugin_again
|
||||
|
||||
- name: Check that enabling enabled plugin succeeds without a change
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin_again.changed == false
|
||||
- enable_plugin_again.enabled == []
|
||||
|
||||
- name: Enable new plugin when 'new_only' option is 'no' (by default) and there are installed plugins
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_mqtt
|
||||
state: enabled
|
||||
check_mode: yes
|
||||
register: enable_plugin_without_new_only
|
||||
|
||||
- name: Check that 'new_only == no' option enables new plugin and disables the old one
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin_without_new_only.changed == true
|
||||
- enable_plugin_without_new_only.enabled == ['rabbitmq_mqtt']
|
||||
- enable_plugin_without_new_only.disabled == ['rabbitmq_management']
|
||||
|
||||
- name: Enable new plugin when 'new_only' option is 'yes' and there are installed plugins
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_mqtt
|
||||
state: enabled
|
||||
new_only: yes
|
||||
check_mode: yes
|
||||
register: enable_plugin_with_new_only
|
||||
|
||||
- name: Check that 'new_only == yes' option just enables new plugin
|
||||
assert:
|
||||
that:
|
||||
- enable_plugin_with_new_only.changed == true
|
||||
- enable_plugin_with_new_only.enabled == ['rabbitmq_mqtt']
|
||||
- enable_plugin_with_new_only.disabled == []
|
||||
|
||||
- name: Disable rabbitmq_management plugin in check mode
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: disabled
|
||||
check_mode: yes
|
||||
register: disable_plugin_in_check_mode
|
||||
|
||||
- name: Check that disabling plugin in check mode succeeds with a change
|
||||
assert:
|
||||
that:
|
||||
- disable_plugin_in_check_mode.changed == true
|
||||
|
||||
- name: Disable rabbitmq_management plugin in check mode again
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: disabled
|
||||
check_mode: yes
|
||||
register: disable_plugin_in_check_mode_again
|
||||
|
||||
- name: Check that disabling plugin in check mode does not make changes
|
||||
assert:
|
||||
that:
|
||||
- disable_plugin_in_check_mode_again.changed == true
|
||||
|
||||
- name: Disable rabbitmq_management plugin
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: disabled
|
||||
register: disable_plugin
|
||||
|
||||
- name: Check that disabling plugin succeeds with a change
|
||||
assert:
|
||||
that:
|
||||
- disable_plugin.changed == true
|
||||
- disable_plugin.disabled == ['rabbitmq_management']
|
||||
|
||||
- name: Disable disabled rabbitmq_management plugin
|
||||
win_rabbitmq_plugin:
|
||||
names: rabbitmq_management
|
||||
state: disabled
|
||||
register: disable_plugin_again
|
||||
|
||||
- name: Check that disabling disabled plugin succeeds without a change
|
||||
assert:
|
||||
that:
|
||||
- disable_plugin_again.changed == false
|
||||
- disable_plugin_again.disabled == []
|
Loading…
Add table
Add a link
Reference in a new issue