rabbitmq_plugin: add integration tests (#40389)
* rabbitmq_plugin: add integration tests * Use import_tasks instead of include
This commit is contained in:
parent
d74ccea44f
commit
89732a1e5f
4 changed files with 78 additions and 0 deletions
5
test/integration/targets/rabbitmq_plugin/aliases
Normal file
5
test/integration/targets/rabbitmq_plugin/aliases
Normal file
|
@ -0,0 +1,5 @@
|
|||
destructive
|
||||
posix/ci/group1
|
||||
skip/osx
|
||||
skip/freebsd
|
||||
skip/rhel
|
2
test/integration/targets/rabbitmq_plugin/meta/main.yml
Normal file
2
test/integration/targets/rabbitmq_plugin/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_rabbitmq
|
2
test/integration/targets/rabbitmq_plugin/tasks/main.yml
Normal file
2
test/integration/targets/rabbitmq_plugin/tasks/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
- import_tasks: tests.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
69
test/integration/targets/rabbitmq_plugin/tasks/tests.yml
Normal file
69
test/integration/targets/rabbitmq_plugin/tasks/tests.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
- block:
|
||||
- set_fact:
|
||||
plugin_name: rabbitmq_top
|
||||
|
||||
- name: Enable plugin
|
||||
rabbitmq_plugin:
|
||||
name: "{{ plugin_name }}"
|
||||
state: enabled
|
||||
register: result
|
||||
|
||||
- name: Get rabbitmq-plugins output
|
||||
shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
|
||||
register: cli_result
|
||||
|
||||
- name: Check that the plugin is enabled
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is success
|
||||
- '"{{ plugin_name }}" in result.enabled'
|
||||
- result.disabled== []
|
||||
- '"[E" in cli_result.stdout'
|
||||
|
||||
- name: Enable plugin (idempotency)
|
||||
rabbitmq_plugin:
|
||||
name: "{{ plugin_name }}"
|
||||
state: enabled
|
||||
register: result
|
||||
|
||||
- name: Check idempotency
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Disable plugin
|
||||
rabbitmq_plugin:
|
||||
name: "{{ plugin_name }}"
|
||||
state: disabled
|
||||
register: result
|
||||
|
||||
- name: Get rabbitmq-plugins output
|
||||
shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
|
||||
register: cli_result
|
||||
|
||||
- name: Check that the plugin is disabled
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is success
|
||||
- result.enabled == []
|
||||
- '"{{ plugin_name }}" in result.disabled'
|
||||
- '"[E" not in cli_result.stdout'
|
||||
|
||||
- name: Disable plugin (idempotency)
|
||||
rabbitmq_plugin:
|
||||
name: "{{ plugin_name }}"
|
||||
state: disabled
|
||||
register: result
|
||||
|
||||
- name: Check idempotency
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
always:
|
||||
- name: Disable plugin
|
||||
rabbitmq_plugin:
|
||||
name: "{{ plugin_name }}"
|
||||
state: disabled
|
Loading…
Reference in a new issue