ansible/test/integration/targets/win_rabbitmq_plugin/tasks/tests.yml

135 lines
3.8 KiB
YAML
Raw Normal View History

- 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 == []