mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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
This commit is contained in:
parent
63bb4c5706
commit
60dcfc3a09
5 changed files with 348 additions and 0 deletions
5
test/integration/targets/rabbitmq_vhost_limits/aliases
Normal file
5
test/integration/targets/rabbitmq_vhost_limits/aliases
Normal file
|
@ -0,0 +1,5 @@
|
|||
destructive
|
||||
shippable/posix/group1
|
||||
skip/osx
|
||||
skip/freebsd
|
||||
skip/rhel
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_rabbitmq
|
|
@ -0,0 +1,5 @@
|
|||
# Rabbitmq lookup
|
||||
- include: ubuntu.yml
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- ansible_distribution_release != 'trusty'
|
163
test/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml
Normal file
163
test/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml
Normal file
|
@ -0,0 +1,163 @@
|
|||
---
|
||||
|
||||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue