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_binding/tasks/tests.yml

133 lines
3.0 KiB
YAML

---
- 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