mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
60dcfc3a09
* 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
163 lines
4.5 KiB
YAML
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
|