1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/rabbitmq_binding/tasks/tests.yml

133 lines
3 KiB
YAML
Raw Normal View History

---
- name: Add test requisites
block:
- name: Add exchange
rabbitmq_exchange:
name: "{{ item }}"
type: direct
with_items:
- exchange-foo
- exchange-bar
- name: Add queue
rabbitmq_queue:
name: queue-foo
- name: Test add binding in check mode
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
check_mode: true
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test add binding
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test add binding idempotence
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
register: add_binding
- name: Check that binding succeeds without a change
assert:
that:
- add_binding.changed == false
- name: Test remove binding in check mode
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
check_mode: true
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true
- name: Test remove binding
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true
- name: Test remove binding idempotence
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == false
- name: Test add exchange to exchange binding
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: exchange-bar
type: exchange
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test remove exchange to exchange binding
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: exchange-bar
type: exchange
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true