You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml

164 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