ansible/test/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml
Hiroyuki Matsuo 60dcfc3a09 Add rabbitmq_vhost_limits module (#37821)
* Improve code structure
* Add author for module
* Now returns some values
* Update module's metadata
* Copy test case of rabbitmq_lookup
* Add test cases for rabbitmq_vhost_limits
* Minor fixes in documentation
* Fix module's return values
* Refactor module
* Improve test case
* Revise English in documentation
* Disable returning values because it's useless & unnecessary
* Work on failures: E261: match PEP8 styles
* Work on failures: E312: add RETURN section in documentation
2018-11-15 10:10:41 +05:30

163 lines
4.5 KiB
YAML

---
- name: Test setting virtual host limits in check mode
block:
- name: Set virtual host limits in check mode
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
check_mode: true
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the check mode does not make any changes
assert:
that:
- shell_result is success
- "'\"max-connections\":64' not in shell_result.stdout"
- "'\"max-queues\":256' not in shell_result.stdout"
- name: Test setting virtual host limits
block:
- name: Set virtual host limits
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually set
assert:
that:
- shell_result is success
- "'\"max-connections\":64' in shell_result.stdout"
- "'\"max-queues\":256' in shell_result.stdout"
- name: Test setting virtual host limits (idempotence)
block:
- name: Set virtual host limits (idempotence)
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
register: module_result
- name: Check the idempotence
assert:
that:
- module_result is not changed
- module_result is success
- name: Test changing virtual host limits
block:
- name: Change virtual host limits
rabbitmq_vhost_limits:
vhost: /
max_connections: 32
state: present
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually set
assert:
that:
- shell_result is success
- "'\"max-connections\":32' in shell_result.stdout"
- "'\"max-queues\":-1' in shell_result.stdout"
- name: Test clearing virtual host limits in check mode
block:
- name: Clear virtual host limits in check mode
rabbitmq_vhost_limits:
vhost: /
state: absent
check_mode: true
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the check mode does not make any changes
assert:
that:
- shell_result is success
- "'\"max-connections\":32' in shell_result.stdout"
- "'\"max-queues\":-1' in shell_result.stdout"
- name: Test clearing virtual host limits
block:
- name: Clear virtual host limits
rabbitmq_vhost_limits:
vhost: /
state: absent
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually cleared
assert:
that:
- shell_result is success
- "'\"max-connections\":' not in shell_result.stdout"
- "'\"max-queues\":' not in shell_result.stdout"
- name: Test clearing virtual host limits (idempotence)
block:
- name: Clear virtual host limits (idempotence)
rabbitmq_vhost_limits:
vhost: /
state: absent
register: module_result
- name: Check the idempotence
assert:
that:
- module_result is not changed
- module_result is success