summaryrefslogtreecommitdiffstats
path: root/collections-debian-merged/ansible_collections/community/rabbitmq/tests
diff options
context:
space:
mode:
Diffstat (limited to 'collections-debian-merged/ansible_collections/community/rabbitmq/tests')
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/aliases7
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/main.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/ubuntu.yml138
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/main.yml3
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/tests.yml132
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/tests.yml137
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/files/image.gifbin0 -> 43 bytes
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/meta/main.yml3
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/main.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/ubuntu.yml171
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/main.yml10
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/tests.yml89
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/tests.yml121
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/aliases6
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/main.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml163
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/files/rabbitmq.conf8
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/meta/main.yml3
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/main.yml3
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/ubuntu.yml63
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml11
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml10
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_certificate.pem19
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_key.pem28
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_certificate.pem20
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_key.pem27
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_certificate.pem20
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_key.pem27
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/tasks/main.yml21
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.10.txt1
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.11.txt1
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore.txt1
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/__init__.py0
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/builtins.py33
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/mock.py122
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/unittest.py38
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/__init__.py0
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/loader.py116
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/path.py8
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/procenv.py90
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/vault_helper.py39
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/yaml_helper.py124
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/__init__.py0
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/rabbitmq_user_fixtures.py181
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/test_rabbitmq_user.py357
-rw-r--r--collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/utils.py50
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/check_matrix.py115
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/cloud.sh19
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/freebsd.sh22
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/linux.sh18
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/osx.sh22
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/remote.sh22
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/rhel.sh22
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/sanity.sh7
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/shippable.sh133
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.py16
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.sh5
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/units.sh110
73 files changed, 2983 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/aliases
new file mode 100644
index 00000000..ea7b5233
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/aliases
@@ -0,0 +1,7 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
+skip/python2.6 # lookups are controller only, and we no longer support Python 2.6 on the controller
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/main.yml
new file mode 100644
index 00000000..740f8998
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/main.yml
@@ -0,0 +1,5 @@
+# Rabbitmq lookup
+- include: ubuntu.yml
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_release != 'trusty'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/ubuntu.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/ubuntu.yml
new file mode 100644
index 00000000..d653b493
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/lookup_rabbitmq/tasks/ubuntu.yml
@@ -0,0 +1,138 @@
+- name: Test failure without pika installed
+ set_fact:
+ rabbit_missing_pika: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@192.168.250.1:5672/%2F', queue='hello', count=3) }}"
+ ignore_errors: yes
+ register: rabbitmq_missing_pika_error
+
+- assert:
+ that:
+ - "'pika python package is required' in rabbitmq_missing_pika_error.msg"
+
+- name: Install pika and requests
+ pip:
+ name: pika<1.0.0,requests
+ state: latest
+
+- name: Test that giving an incorrect amqp protocol in URL will error
+ set_fact:
+ rabbitmq_test_protocol: "{{ lookup('community.rabbitmq.rabbitmq', url='zzzamqp://guest:guest@192.168.250.1:5672/%2F', queue='hello', count=3) }}"
+ ignore_errors: yes
+ register: rabbitmq_protocol_error
+
+- assert:
+ that:
+ - "rabbitmq_protocol_error is failed"
+ - "'URL malformed' in rabbitmq_protocol_error.msg"
+
+- name: Test that giving an incorrect IP address in URL will error
+ set_fact:
+ rabbitmq_test_protocol: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@xxxxx192.112312368.250.1:5672/%2F', queue='hello', count=3) }}"
+ ignore_errors: yes
+ register: rabbitmq_ip_error
+
+- assert:
+ that:
+ - "rabbitmq_ip_error is failed"
+ - "'Connection issue' in rabbitmq_ip_error.msg"
+
+- name: Test missing parameters will error
+ set_fact:
+ rabbitmq_test_protocol: "{{ lookup('community.rabbitmq.rabbitmq') }}"
+ ignore_errors: yes
+ register: rabbitmq_params_error
+
+- assert:
+ that:
+ - "rabbitmq_params_error is failed"
+ - "'URL is required for rabbitmq lookup.' in rabbitmq_params_error.msg"
+
+- name: Test missing queue will error
+ set_fact:
+ rabbitmq_queue_protocol: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@192.168.250.1:5672/%2F') }}"
+ ignore_errors: yes
+ register: rabbitmq_queue_error
+
+- assert:
+ that:
+ - "rabbitmq_queue_error is failed"
+ - "'Queue is required for rabbitmq lookup' in rabbitmq_queue_error.msg"
+
+- name: Enables the rabbitmq_management plugin
+ rabbitmq_plugin:
+ names: rabbitmq_management
+ state: enabled
+
+- name: Setup test queue
+ rabbitmq_queue:
+ name: hello
+
+- name: Post test message to the exchange (string)
+ uri:
+ url: http://localhost:15672/api/exchanges/%2f/amq.default/publish
+ method: POST
+ body: '{"properties":{},"routing_key":"hello","payload":"ansible-test","payload_encoding":"string"}'
+ user: guest
+ password: guest
+ force_basic_auth: yes
+ return_content: yes
+ headers:
+ Content-Type: "application/json"
+ register: post_data
+
+
+- name: Post test message to the exchange (json)
+ uri:
+ url: http://localhost:15672/api/exchanges/%2f/amq.default/publish
+ method: POST
+ body: '{"properties":{"content_type": "application/json"},"routing_key":"hello","payload":"{\"key\": \"value\" }","payload_encoding":"string"}'
+ user: guest
+ password: guest
+ force_basic_auth: yes
+ return_content: yes
+ headers:
+ Content-Type: "application/json"
+ register: post_data_json
+
+- name: Test retrieve messages
+ set_fact:
+ rabbitmq_msg: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@localhost:5672/%2f/hello', queue='hello') }}"
+ ignore_errors: yes
+ register: rabbitmq_msg_error
+
+- name: Ensure two messages received
+ assert:
+ that:
+ - "rabbitmq_msg_error is not failed"
+ - rabbitmq_msg | length == 2
+
+- name: Ensure first message is a string
+ assert:
+ that:
+ - rabbitmq_msg[0].msg == "ansible-test"
+
+- name: Ensure second message is json
+ assert:
+ that:
+ - rabbitmq_msg[1].json.key == "value"
+
+- name: Test missing vhost
+ set_fact:
+ rabbitmq_msg: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@localhost:5672/missing/', queue='hello') }}"
+ ignore_errors: yes
+ register: rabbitmq_vhost_error
+
+- assert:
+ that:
+ - "rabbitmq_vhost_error is failed"
+ - "'NOT_ALLOWED' in rabbitmq_vhost_error.msg"
+
+# Tidy up
+- name: Uninstall pika and requests
+ pip:
+ name: pika,requests
+ state: absent
+
+- name: Disable the rabbitmq_management plugin
+ rabbitmq_plugin:
+ names: rabbitmq_management
+ state: disabled
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/main.yml
new file mode 100644
index 00000000..4d3414ea
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/main.yml
@@ -0,0 +1,3 @@
+---
+- import_tasks: tests.yml
+ when: ansible_distribution == 'Ubuntu'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/tests.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/tests.yml
new file mode 100644
index 00000000..5021ed22
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_binding/tasks/tests.yml
@@ -0,0 +1,132 @@
+---
+- 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
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/main.yml
new file mode 100644
index 00000000..593906fb
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/main.yml
@@ -0,0 +1,2 @@
+- import_tasks: tests.yml
+ when: ansible_distribution == 'Ubuntu'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/tests.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/tests.yml
new file mode 100644
index 00000000..148f1914
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_plugin/tasks/tests.yml
@@ -0,0 +1,137 @@
+- block:
+ - set_fact:
+ plugin_name: rabbitmq_top
+
+ - name: Enable plugin [online]
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: enabled
+ new_only: True
+ register: result
+
+ - name: Get rabbitmq-plugins output
+ shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
+ register: cli_result
+
+ - name: Check that the plugin is enabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - '"{{ plugin_name }}" in result.enabled'
+ - result.disabled == []
+ - '"[E" in cli_result.stdout'
+
+ - name: Enable plugin [online] (idempotency)
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: enabled
+ new_only: True
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Disable plugin [online]
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: disabled
+ register: result
+
+ - name: Get rabbitmq-plugins output
+ shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
+ register: cli_result
+
+ - name: Check that the plugin is disabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - result.enabled == []
+ - '"{{ plugin_name }}" in result.disabled'
+ - '"[E" not in cli_result.stdout'
+
+ - name: Disable plugin [online] (idempotency)
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: disabled
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Enable plugin [offline]
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: enabled
+ broker_state: offline
+ new_only: True
+ register: result
+
+ - name: Get rabbitmq-plugins output
+ shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
+ register: cli_result
+
+ - name: Check that the plugin is enabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - '"{{ plugin_name }}" in result.enabled'
+ - result.disabled == []
+ - '"[E" in cli_result.stdout'
+
+ - name: Enable plugin [offline] (idempotency)
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: enabled
+ broker_state: offline
+ new_only: True
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Disable plugin [offline]
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: disabled
+ broker_state: offline
+ register: result
+
+ - name: Get rabbitmq-plugins output
+ shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
+ register: cli_result
+
+ - name: Check that the plugin is disabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - result.enabled == []
+ - '"{{ plugin_name }}" in result.disabled'
+ - '"[E" not in cli_result.stdout'
+
+ - name: Disable plugin [offline] (idempotency)
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: disabled
+ broker_state: offline
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ always:
+ - name: Disable plugin
+ rabbitmq_plugin:
+ name: "{{ plugin_name }}"
+ state: disabled
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/files/image.gif b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/files/image.gif
new file mode 100644
index 00000000..0589d208
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/files/image.gif
Binary files differ
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/meta/main.yml
new file mode 100644
index 00000000..f0eb571b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/meta/main.yml
@@ -0,0 +1,3 @@
+dependencies:
+ - setup_rabbitmq
+ - setup_remote_tmp_dir
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/main.yml
new file mode 100644
index 00000000..740f8998
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/main.yml
@@ -0,0 +1,5 @@
+# Rabbitmq lookup
+- include: ubuntu.yml
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_release != 'trusty'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/ubuntu.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/ubuntu.yml
new file mode 100644
index 00000000..698c72e2
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_publish/tasks/ubuntu.yml
@@ -0,0 +1,171 @@
+- name: Install requests and pika
+ pip:
+ name: requests,pika<1.0.0
+ state: present
+
+- name: RabbitMQ basic publish test
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: 'publish_test'
+ body: "Hello world from ansible module rabbitmq_publish"
+ content_type: "text/plain"
+ register: rabbit_basic_output1
+
+- assert:
+ that:
+ - "rabbit_basic_output1 is not failed"
+ - "'publish_test' in rabbit_basic_output1.result.msg"
+ - "'publish_test' in rabbit_basic_output1.result.queue"
+ - "'text/plain' in rabbit_basic_output1.result.content_type"
+
+
+# Testing random queue
+- name: Publish to random queue
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ body: "RANDOM QUEUE POST"
+ content_type: "text/plain"
+ register: rabbit_random_queue_output
+
+- assert:
+ that:
+ - "rabbit_random_queue_output is not failed"
+ - "'amq.gen' in rabbit_random_queue_output.result.msg"
+ - "'amq.gen' in rabbit_random_queue_output.result.queue"
+ - "'text/plain' in rabbit_random_queue_output.result.content_type"
+
+- name: Copy binary to remote
+ copy:
+ src: "{{ role_path }}/files/image.gif"
+ dest: "{{ remote_tmp_dir }}/image.gif"
+
+- name: Publish binary to a queue
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: publish_test
+ src: "{{ remote_tmp_dir }}/image.gif"
+ register: rabbitmq_publish_file
+
+- assert:
+ that:
+ - "rabbitmq_publish_file is not failed"
+ - "'publish_test' in rabbitmq_publish_file.result.queue"
+ - "'image/gif' in rabbitmq_publish_file.result.content_type"
+
+- name: Raise error for src and body defined
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: 'publish_test'
+ src: "{{ remote_tmp_dir }}/image.gif"
+ body: blah
+ register: rabbit_basic_fail_output1
+ ignore_errors: yes
+
+- assert:
+ that:
+ - "rabbit_basic_fail_output1 is failed"
+ - "'parameters are mutually exclusive' in rabbit_basic_fail_output1.msg"
+
+- name: Publish a file that does not exist
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: 'publish_test'
+ src: 'aaaaaaajax-loader.gif'
+ register: file_missing_fail
+ ignore_errors: yes
+
+- assert:
+ that:
+ - "file_missing_fail is failed"
+ - "'Unable to open file' in file_missing_fail.msg"
+
+- name: Publish with proto/host/port/user/pass
+ rabbitmq_publish:
+ proto: amqp
+ host: localhost
+ port: 5672
+ username: guest
+ password: guest
+ vhost: '%2F'
+ queue: publish_test
+ body: Testing with proto/host/port/username/password/vhost
+ register: host_port_output
+
+- assert:
+ that:
+ - "host_port_output is not failed"
+
+- name: Publish with host/port/user but missing proto
+ rabbitmq_publish:
+ host: localhost
+ port: 5672
+ username: guest
+ password: guest
+ vhost: '%2F'
+ queue: publish_test
+ body: Testing with proto/host/port/username/password/vhost
+ ignore_errors: yes
+ register: host_port_missing_proto_output
+
+- assert:
+ that:
+ - "host_port_missing_proto_output is failed"
+ - "'Connection parameters must be passed via' in host_port_missing_proto_output.msg"
+
+- name: Publish with proto/host/port/user and url
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ proto: amqp
+ host: localhost
+ port: 5672
+ username: guest
+ password: guest
+ vhost: '%2F'
+ queue: publish_test
+ body: Testing with proto/host/port/username/password/vhost
+ ignore_errors: yes
+ register: host_and_url_output
+
+- assert:
+ that:
+ - "host_and_url_output is failed"
+ - "'cannot be specified at the same time' in host_and_url_output.msg"
+
+- name: Publish headers to queue
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: 'publish_test'
+ body: blah
+ headers:
+ myHeader: Value1
+ secondHeader: Value2
+ register: test_headers1
+ ignore_errors: yes
+
+- name: Publish headers with file
+ rabbitmq_publish:
+ url: "amqp://guest:guest@localhost:5672/%2F"
+ queue: 'publish_test'
+ src: "{{ remote_tmp_dir }}/image.gif"
+ headers:
+ myHeader: Value1
+ secondHeader: Value2
+ register: test_headers2
+ ignore_errors: yes
+
+- name: Collect all messages off the publish queue
+ set_fact:
+ messages: "{{ lookup('community.rabbitmq.rabbitmq', url='amqp://guest:guest@localhost:5672/%2F', queue='publish_test') }}"
+
+- name: Check contents of published messages
+ assert:
+ that:
+ - messages|length == 5
+ - "'Hello world from ansible module rabbitmq_publish' in messages[0]['msg']"
+ - "'text/plain' in messages[0]['content_type']"
+ - "'image/gif' in messages[1]['content_type']"
+ - "'image.gif' in messages[1]['headers']['filename']"
+ - "'Testing with proto/host/port/username/password/vhost' in messages[2]['msg']"
+# - messages[3]['headers']['myHeader'] is defined
+# - messages[4]['headers']['filename'] is defined
+# - messages[4]['headers']['secondHeader'] is defined
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/main.yml
new file mode 100644
index 00000000..e03d4c7a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+
+- when: ansible_distribution == 'Ubuntu'
+ block:
+
+ - import_tasks: tests.yml
+
+ - import_tasks: tests.yml
+ environment:
+ RABBITMQ_NODENAME: test
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/tests.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/tests.yml
new file mode 100644
index 00000000..62274374
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_user/tasks/tests.yml
@@ -0,0 +1,89 @@
+---
+
+- name: Test add user
+ block:
+ - name: Add user
+ rabbitmq_user: user=joe password=changeme
+ register: add_user
+
+ - name: Check that user adding succeeds with a change
+ assert:
+ that:
+ - add_user.changed == true
+
+- name: Test add user idempotence
+ block:
+ - name: Add user
+ rabbitmq_user: user=joe password=changeme
+ register: add_user
+
+ - name: Check that user adding succeeds without a change
+ assert:
+ that:
+ - add_user.changed == false
+
+- name: Test change user permissions
+ block:
+ - name: Add user with permissions
+ rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
+ register: add_user
+
+ - name: Check that changing permissions succeeds with a change
+ assert:
+ that:
+ - add_user.changed == true
+
+- name: Test change user permissions idempotence
+ block:
+ - name: Add user with permissions
+ rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
+ register: add_user
+
+ - name: Check that changing permissions succeeds without a change
+ assert:
+ that:
+ - add_user.changed == false
+
+- name: Test add user tags
+ block:
+ - name: Add user with tags
+ rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=management,administrator
+ register: add_user
+
+ - name: Check that adding tags succeeds with a change
+ assert:
+ that:
+ - add_user.changed == true
+
+- name: Test add user tags idempotence
+ block:
+ - name: Add user with tags
+ rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=administrator,management
+ register: add_user
+
+ - name: Check that adding tags succeeds without a change
+ assert:
+ that:
+ - add_user.changed == false
+
+- name: Test remove user
+ block:
+ - name: Remove user
+ rabbitmq_user: user=joe state=absent
+ register: remove_user
+
+ - name: Check that user removing succeeds with a change
+ assert:
+ that:
+ - remove_user.changed == true
+
+- name: Test remove user idempotence
+ block:
+ - name: Remove user
+ rabbitmq_user: user=joe state=absent
+ register: remove_user
+
+ - name: Check that user removing succeeds without a change
+ assert:
+ that:
+ - remove_user.changed == false
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/main.yml
new file mode 100644
index 00000000..593906fb
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/main.yml
@@ -0,0 +1,2 @@
+- import_tasks: tests.yml
+ when: ansible_distribution == 'Ubuntu'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/tests.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/tests.yml
new file mode 100644
index 00000000..019c5ede
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost/tasks/tests.yml
@@ -0,0 +1,121 @@
+- block:
+ - set_fact:
+ vhost_name: /test
+
+ - name: Add host
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ state: present
+ register: result
+
+ - name: Check that the host was created successfuly
+ shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
+ register: ctl_result
+
+ - name: Check that the host is added
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - '"false" in ctl_result.stdout' # value for tracing, false is disabled
+
+ - name: Add host (idempotency)
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ state: present
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Enable tracing
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ tracing: yes
+ register: result
+
+ - name: Get rabbitmqctl output
+ shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
+ register: ctl_result
+
+ - name: Check that tracing is enabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - '"true" in ctl_result.stdout' # value for tracing, true is enabled
+
+ - name: Enable tracing (idempotency)
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ tracing: yes
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Disable tracing
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ tracing: no
+ register: result
+
+ - name: Get rabbitmqctl output
+ shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
+ register: ctl_result
+
+ - name: Check that tracing is disabled
+ assert:
+ that:
+ - result is changed
+ - result is success
+ - '"false" in ctl_result.stdout' # value for tracing, false is disabled
+
+ - name: Disable tracing (idempotency)
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ tracing: no
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ - name: Remove host
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ state: absent
+ register: result
+
+ - name: Get rabbitmqctl output
+ shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
+ register: ctl_result
+ failed_when: ctl_result.rc == 0
+
+ - name: Check that the host is removed
+ assert:
+ that:
+ - result is changed
+ - result is success
+
+ - name: Remove host (idempotency)
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ state: absent
+ register: result
+
+ - name: Check idempotency
+ assert:
+ that:
+ - result is not changed
+
+ always:
+ - name: Remove host
+ rabbitmq_vhost:
+ name: "{{ vhost_name }}"
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/aliases b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/aliases
new file mode 100644
index 00000000..f37e6c6f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/group1
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/meta/main.yml
new file mode 100644
index 00000000..05ab5900
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_rabbitmq
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/main.yml
new file mode 100644
index 00000000..740f8998
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/main.yml
@@ -0,0 +1,5 @@
+# Rabbitmq lookup
+- include: ubuntu.yml
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_release != 'trusty'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml
new file mode 100644
index 00000000..8d0a6480
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/rabbitmq_vhost_limits/tasks/ubuntu.yml
@@ -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
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/files/rabbitmq.conf b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/files/rabbitmq.conf
new file mode 100644
index 00000000..1e602175
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/files/rabbitmq.conf
@@ -0,0 +1,8 @@
+listeners.ssl.default = 5671
+
+ssl_options.cacertfile = /tls/ca_certificate.pem
+ssl_options.certfile = /tls/server_certificate.pem
+ssl_options.keyfile = /tls/server_key.pem
+ssl_options.password = bunnies
+ssl_options.verify = verify_peer
+ssl_options.fail_if_no_peer_cert = false
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/meta/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/meta/main.yml
new file mode 100644
index 00000000..af05db79
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - setup_tls
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/main.yml
new file mode 100644
index 00000000..4f35f16f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/main.yml
@@ -0,0 +1,3 @@
+---
+- include: ubuntu.yml
+ when: ansible_distribution == 'Ubuntu'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/ubuntu.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/ubuntu.yml
new file mode 100644
index 00000000..6d7a3ef0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_rabbitmq/tasks/ubuntu.yml
@@ -0,0 +1,63 @@
+---
+# https://www.rabbitmq.com/install-debian.html#apt-pinning
+- name: Pin erlang version that rabbitmq supports
+ copy:
+ dest: /etc/apt/preferences.d/erlang
+ content: |
+ Package: erlang*
+ Pin: version 1:20.3.8.18-1
+ Pin-Priority: 1000
+
+ Package: esl-erlang
+ Pin: version 1:20.3.6
+ Pin-Priority: 1000
+
+- name: Install https transport for apt
+ apt:
+ name: apt-transport-https
+ state: latest
+ force: yes
+
+- name: Add RabbitMQ release signing key
+ apt_key:
+ url: https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/setup_rabbitmq/rabbitmq-release-signing-key.asc
+ state: present
+
+- name: Add RabbitMQ Erlang repository
+ apt_repository:
+ repo: "deb https://dl.bintray.com/rabbitmq-erlang/debian {{ ansible_distribution_release }} erlang-20.x"
+ filename: 'rabbitmq-erlang'
+ state: present
+ update_cache: yes
+
+# Required by the rabbitmq modules that uses the management API
+- name: Install requests
+ pip:
+ name: requests
+
+- name: Install RabbitMQ Server
+ apt:
+ deb: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_rabbitmq/rabbitmq-server_3.7.14-1_all.deb
+
+- name: Install RabbitMQ TLS dependencies
+ apt:
+ name: "{{ item }}"
+ state: latest
+ loop:
+ - erlang-asn1
+ - erlang-crypto
+ - erlang-public-key
+ - erlang-ssl
+
+- name: Ensure TLS config
+ copy:
+ src: rabbitmq.conf
+ dest: /etc/rabbitmq/rabbitmq.conf
+
+- name: Start RabbitMQ service
+ service:
+ name: rabbitmq-server
+ state: started
+
+- name: Enable management
+ command: rabbitmq-plugins enable --online rabbitmq_management
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml
new file mode 100644
index 00000000..229037c8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/handlers/main.yml
@@ -0,0 +1,5 @@
+- name: delete temporary directory
+ include_tasks: default-cleanup.yml
+
+- name: delete temporary directory (windows)
+ include_tasks: windows-cleanup.yml
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml
new file mode 100644
index 00000000..39872d74
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default-cleanup.yml
@@ -0,0 +1,5 @@
+- name: delete temporary directory
+ file:
+ path: "{{ remote_tmp_dir }}"
+ state: absent
+ no_log: yes
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml
new file mode 100644
index 00000000..1e0f51b8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/default.yml
@@ -0,0 +1,11 @@
+- name: create temporary directory
+ tempfile:
+ state: directory
+ suffix: .test
+ register: remote_tmp_dir
+ notify:
+ - delete temporary directory
+
+- name: record temporary directory
+ set_fact:
+ remote_tmp_dir: "{{ remote_tmp_dir.path }}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml
new file mode 100644
index 00000000..f8df391b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_remote_tmp_dir/tasks/main.yml
@@ -0,0 +1,10 @@
+- name: make sure we have the ansible_os_family and ansible_distribution_version facts
+ setup:
+ gather_subset: distribution
+ when: ansible_facts == {}
+
+- include_tasks: "{{ lookup('first_found', files)}}"
+ vars:
+ files:
+ - "{{ ansible_os_family | lower }}.yml"
+ - "default.yml"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_certificate.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_certificate.pem
new file mode 100644
index 00000000..a438d926
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_certificate.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDAjCCAeqgAwIBAgIJANguFROhaWocMA0GCSqGSIb3DQEBCwUAMDExIDAeBgNV
+BAMMF1RMU0dlblNlbGZTaWduZWR0Um9vdENBMQ0wCwYDVQQHDAQkJCQkMB4XDTE5
+MDExMTA4MzMxNVoXDTI5MDEwODA4MzMxNVowMTEgMB4GA1UEAwwXVExTR2VuU2Vs
+ZlNpZ25lZHRSb290Q0ExDTALBgNVBAcMBCQkJCQwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQDqVt84czSxWnWW4Ng6hmKE3NarbLsycwtjrYBokV7Kk7Mp
+7PrBbYF05FOgSdJLvL6grlRSQK2VPsXdLfEv5uFXX6gyd2WQwKCiGGf4UY4ZIl4l
+JVpSDsBV2orR4pOIf1s1+iSwvcRQkX46SVjoKWbDUc4VLo1uy8UvavQI+DMioYyy
+0K2MbRs7oG2rdKks8zisfT0ymKnrFTdVeUjIrg0sStaMnf9VVkcEeYkfNY0vWqdn
+CV5wPfDBlnnxGMgqGdLSpzfyJ7qafFET+q+gOvjsEqzn7DvlPkmk86hIIWXKi3aM
+A9swknL3rnagJL6GioWRpYUwKdRKmZxdyr4I2JTTAgMBAAGjHTAbMAwGA1UdEwQF
+MAMBAf8wCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBCwUAA4IBAQACTpPBf5WSwZ7r
+hrbPUN3qVh70HI0ZNK2jlK6b5fpSdw3JI/GQl0Kw3eGICLzwTByWvhD62U7IigL5
+0UWxWuEod310Y/qo/7OxRVPp5PH/0oNGoKHhEzas2ii0heQYGsHQUKGzYNNyVfjy
+nqBFz5AcKf067LcXivYqod6JDQHqFq/5/hWlIsHHrZIeijqqtthPq39GlGAYO+AB
+U66nzlH7YQgmfYfy6l7O4LsjXf/bz9rWvueO3NqCsmXV+FacDkOkwWA5Kf6rcgNL
+3G+2HAVTRIXDnO4ShnK6aYMW+UklpYRlVYBBUOdwoNIp5gI+BlSc1IuF6PdLVt3q
+VdjN1MjY
+-----END CERTIFICATE-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_key.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_key.pem
new file mode 100644
index 00000000..0a950eda
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/ca_key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDqVt84czSxWnWW
+4Ng6hmKE3NarbLsycwtjrYBokV7Kk7Mp7PrBbYF05FOgSdJLvL6grlRSQK2VPsXd
+LfEv5uFXX6gyd2WQwKCiGGf4UY4ZIl4lJVpSDsBV2orR4pOIf1s1+iSwvcRQkX46
+SVjoKWbDUc4VLo1uy8UvavQI+DMioYyy0K2MbRs7oG2rdKks8zisfT0ymKnrFTdV
+eUjIrg0sStaMnf9VVkcEeYkfNY0vWqdnCV5wPfDBlnnxGMgqGdLSpzfyJ7qafFET
++q+gOvjsEqzn7DvlPkmk86hIIWXKi3aMA9swknL3rnagJL6GioWRpYUwKdRKmZxd
+yr4I2JTTAgMBAAECggEBALpg9ZDUMCiOpc+mbNO/ZkP90M7u38Q0M+7HY8XHOPkt
+l+XUkWueSMRLhSeLDzMlnwf1HyN8RZLaJkzP6XAL1VXEwuXAiIskaZ4Cg07Arp/W
+8cHhf4CcMuUVuCtOZcC+ajD4Do5zn9vkm9yH0ap0o0LdoWa/a8WfU+luy0EHBsSW
+6qqI+nqNFmISluVbfWt7t3zp273+8sir6YeHQu9G91/jzggv8rHmu4EHhi3cnU0K
+vY6OPCGBL7nrg9Rv1LSFpH95TvlIM6/Cm0AjgW7m6XwWUTaI9p+GvKzrYUSLd9L/
+QxlmAwiu/sBTXLrsWyr8XEtj+lVGxQ6eFbf6E+lUm8ECgYEA+8Wgmhf3VsC3gvJz
+w2jApEoOioD5iGOWGClGVURkfaBhFELr4XCTVMdBuCtxT7LYTMHTAlBqIbdWDjB4
+m/E417hLGogSDy7j0R0Mx75OOGEitxYUhe0VGDNoytgCNd2UnTMt42lp+9vAHZag
+INhVDOnxRNdtNTf1yYkWUMEbh1sCgYEA7kZNJXPVYJtR78+km/Gcv64Umci7KUV+
+hYc7chR5xv3cXvXg5eojKa4G7CyMQTX7VnRa6CiQKdN73AbIAhS4Oy5UlCOKtmb8
+xnBiOAYwSpOfIeZhjq0RvEeZX0t6u7XsErBZ03rEPKXF2nNDo1x8byrlKPtlUzwJ
+gb5yjmK/mekCgYEA1TWQAs5m4+2Bun+tbv7nnHkmhT4hktGays0xRYYMf6Jwc6MU
+dC5MZg/zZI5Nf8uZhq7hDWWh6vmCA7QifxSxKWVlHIu8l2UDAhRSvVg4j2Aa8Obe
+7GdQZNUsWhLBFHKXpuQvaRTc7q8yqxvicM4igDQg4EZ6sgW4vDm+TxapRF8CgYAz
+n6mhPqpxRtWGxo8cdkmGwfmWpAXg2DykQ3teqQ8FTQUM0erLBWJe6mR3kONGUaLF
+xWnYuMkbNsW0EwgMY17S+6O5gMXR5RhJChpNlxGpZrhoiNiEJ/0atMyG9/x8ZNrj
+5a9ggU248hWe0bBK2YPgNgP2UBlQ4kYRBSkerkhi2QKBgF+tlpyqcU+0iY82qRS2
+wMf7oI2pWR8nX9LPAY/nnvwWvqwcAFJPMlSMTu8Ext6h7l9yu+7JGL6JWwsO57Lb
+Gm/RxbuZ/kG/13+lSNmZiyHrhj6hZhkAMeFM34fpT4+DBXqSxZuvdrmwBc5B2jYg
+F9Bv8gcmZlGhqONL23evr9Gu
+-----END PRIVATE KEY-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_certificate.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_certificate.pem
new file mode 100644
index 00000000..501d8389
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_certificate.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDRjCCAi6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADAxMSAwHgYDVQQDDBdUTFNH
+ZW5TZWxmU2lnbmVkdFJvb3RDQTENMAsGA1UEBwwEJCQkJDAeFw0xOTAxMTEwODMz
+MThaFw0yOTAxMDgwODMzMThaMC0xGjAYBgNVBAMMEWFuc2libGUudGxzLnRlc3Rz
+MQ8wDQYDVQQKDAZjbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQCoM+OQ3HCnCUAAz9KGGTwWB9hQbUfAZXm/stlb2/uOAp3rNwxAlCs/giymBHE6
+Iu6mrK006Vn+Z9ibqIrD2LuCOxcu25y8goqG62TgdP5sa9wR+597s0XssnwnaY8y
+bJ3p2zWAJvMgqQ0iNW/ZynpWbO85K5SryUykF7FAeNU9ogGGlIwCPjHhPvnwjkqd
+yDqaA1VaJKDUWIF9joI7sV4VLgGhQvzXRrHULsTeIF2m0+ebL0PTNEWHQ0dtgLYX
+kW7YO4Y6+n3cjHNH4qTof8V30EK8pk8kTdJ/x6ubwf+klFCAyroOxNOaxUy299Oo
+yD6qIPJPnGkPhrKtWnWIhNzJAgMBAAGjbTBrMAkGA1UdEwQCMAAwCwYDVR0PBAQD
+AgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMDwGA1UdEQQ1MDOCEWFuc2libGUudGxz
+LnRlc3RzghNNYWNCb29rLVByby00LmxvY2Fsgglsb2NhbGhvc3QwDQYJKoZIhvcN
+AQELBQADggEBAK214+VVXnGnsUlvd9Q6A2Ea6UGrr6b7xkmlnIaNd+6xoUsDsHob
+srHYm7UC0uLi1KwSunI7AU5ZELVEUfAmJzh3O4d6C5sQyqKYPqd5harWOQ3BOD0I
+plHpp7qMtsPDuJBtmE/bmvF85eto0H7pPz+cTTXRlOaVVeiHjMggFcXdy1MzGo9C
+X/4wLQmsFeypTfe+ZGqvDh99VV+ffNMIsMh+opWEloaKiHmDKB6S9aC/MsVVM4RR
+nHm/UKTOukaGE9QIPkSSaygv3sBkVnQ2SHMvvtnjPHVHlizNoq6+YTnuOvKpo4o5
+V7Bij+W7rkBQLsEfwv2IC+gzmRz2yxr2tXk=
+-----END CERTIFICATE-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_key.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_key.pem
new file mode 100644
index 00000000..850260a8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/client_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAqDPjkNxwpwlAAM/Shhk8FgfYUG1HwGV5v7LZW9v7jgKd6zcM
+QJQrP4IspgRxOiLupqytNOlZ/mfYm6iKw9i7gjsXLtucvIKKhutk4HT+bGvcEfuf
+e7NF7LJ8J2mPMmyd6ds1gCbzIKkNIjVv2cp6VmzvOSuUq8lMpBexQHjVPaIBhpSM
+Aj4x4T758I5Kncg6mgNVWiSg1FiBfY6CO7FeFS4BoUL810ax1C7E3iBdptPnmy9D
+0zRFh0NHbYC2F5Fu2DuGOvp93IxzR+Kk6H/Fd9BCvKZPJE3Sf8erm8H/pJRQgMq6
+DsTTmsVMtvfTqMg+qiDyT5xpD4ayrVp1iITcyQIDAQABAoIBAHPszzpXs4xr46Cr
+mvyxB6hnX76OkpUXWwGz0fptcsI9K3mhRuB7PhNXNE53YVIgITreZ8G/0jZ0e+VM
+E9dG2HS5JRE2ap/BmJfERJIuD+vJqrL6KMCondi0arz/E6I9GdjDK+xW69nmqRaa
+nawM0KQgD//m+WAsLJYrfg5hORZwI2SHaahawnCp0QaMmz3bdDWKRacM3q0UFX46
+Ze6CaZkUn+e1rHsTMcZBvxQWIVzysFNXh150idIB/PxL5YfCQqTSAj1c/nxaxz6a
+BvHFlpaYR3tvXXlexxfjglCwsGyckbvTyP1cBZqpv5oES+VKt2PrOve9Zyax+CYT
+0uQf6cECgYEA09+46QHXLfWh6jiJYu9skC9UrLU5czfCNB6PrUtFcjPFMYjZDcw9
+inJmcuTPXmfplxc47YDfpwotU+szTJDF+R8kknnfw9zVr/sIwZ5wsFfUQl/56Svn
+AIOVvHHvcvMX95XKGiuTsoCIJZNjJN3l3ztu/bRciuiVLyizglwIVrMCgYEAyzvK
+PFlWilbp3GPJlnW7x1bUxe1ziLE/Um+ujZx96+fy34hJLFdNdNzpNUjoOf3IDTGq
+6xl+vXcf12gimWMFcD3qNIGKHBDM9cIB2RDbb6YcqI8lOqopsmOyGmVLPkRpCoUK
+72kacQwvw6M9xjmpiG3dN8lE881jDmZi+hyCnJMCgYEAoIQnQAhP8Jbeo2dP1q+T
+bS0elnX532uH6xqYOW8EXwAPznZiEw0ANspzCWqGHHzXQMusKmtvhcq1CpXvWHt6
+MUHB4GMK/wVosxmZya5yq3bu7ZZu7JOBQCdwosMi6NB5AO7vnaIUFLFB9E3UWBLw
+243YicdCMU8B7yeD0ChPfPcCgYA1dYHKBBn+g8Q6Y8lIGaoOUmnfsok8gJtOfPAm
+ce6xmi7J29iboE9QmTeC+62Sa44u4ky6UNeE0QwAJnVLcb+hebfcneKNZWH0l1bT
+GVsPcFuDfzvkxZP4R782sERtmaMj0EFDHpuE9xatWIhMVyigKX4SSZAorXML+6S3
+c75rnwKBgBR+WU934wS+DbwTLlUB2mJWqJMEbOH/CUwPC7+VN4h1h3/i455iAeiU
+BizLS0SlD+MoSbC7URcZuquqGkmMlnJXoxF+NdxoWZK78tYNftryWoR87TloiVc/
+LhkxZxje4tgW/mTLqH3zKDoyyzDzG6Q6tAUN2ZTjJFEws7qF30Qe
+-----END RSA PRIVATE KEY-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_certificate.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_certificate.pem
new file mode 100644
index 00000000..4a0ebc6e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_certificate.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDRjCCAi6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAxMSAwHgYDVQQDDBdUTFNH
+ZW5TZWxmU2lnbmVkdFJvb3RDQTENMAsGA1UEBwwEJCQkJDAeFw0xOTAxMTEwODMz
+MTZaFw0yOTAxMDgwODMzMTZaMC0xGjAYBgNVBAMMEWFuc2libGUudGxzLnRlc3Rz
+MQ8wDQYDVQQKDAZzZXJ2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQDIwErHwAesRBfd9HiZkmB3VYh28c1QkE9I8nYyHJKX2ZBUhAzK+h80BkcTJJ94
+265qWyACH/wl54Xe/ofFUFrGa4vz0qz4UkL/KI0OGw28Y4qnKdorb9DumbiIPB+9
+I9TJT9vhtXTxBNlBTpv3ONHL8EzdV6ZmuvELU11H27oQ4xoUYhfXPXLMLK0sOnXZ
+lt0BOMMd5fVpJVa8fvXiw3626a0aXCr4e/MWUsBFRnzrXfgoW+AjYoTjKKS2hLYo
+8//MM05h7ROIXrNe990sf9C1G+fOThmOMszK9sjMhu2xHranRcz5aA0UTfyOjTs8
+9WexUYhC5VorYyRWtVZu2mDjAgMBAAGjbTBrMAkGA1UdEwQCMAAwCwYDVR0PBAQD
+AgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMDwGA1UdEQQ1MDOCEWFuc2libGUudGxz
+LnRlc3RzghNNYWNCb29rLVByby00LmxvY2Fsgglsb2NhbGhvc3QwDQYJKoZIhvcN
+AQELBQADggEBAFoPBeB6tQhFS1198sia5NDHDDrghDOIlE0QbaoA+MSKzsaIy8Mu
+mNcM2ewYpT600XXTBxcqF6/vuKL9OEbvivtRYQu1YfkifN1jzREoWTieUkR5ytzt
+8ATfFkgTWJmiRiOIb/fNgewvhd+aKxep0OGwDiSKKl1ab6F17Cp4iK8sDBWmnUb6
+0Wf7pfver1Gl0Gp8vRXGUuc8a7udA9a8mV70HJlLkMdMvR9U8Bqih0+iRaqNWXRZ
+7Lc6v5LbzrW/ntilmgU6F0lwxPydg49MY4UrSXcjYLZs9T4iYHwTfLxFjFMIgGwn
+peYMKRj18akP9i2mjj5O2mRu4K+ecuUSOGI=
+-----END CERTIFICATE-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_key.pem b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_key.pem
new file mode 100644
index 00000000..c79ab648
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/files/server_key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAyMBKx8AHrEQX3fR4mZJgd1WIdvHNUJBPSPJ2MhySl9mQVIQM
+yvofNAZHEySfeNuualsgAh/8JeeF3v6HxVBaxmuL89Ks+FJC/yiNDhsNvGOKpyna
+K2/Q7pm4iDwfvSPUyU/b4bV08QTZQU6b9zjRy/BM3VemZrrxC1NdR9u6EOMaFGIX
+1z1yzCytLDp12ZbdATjDHeX1aSVWvH714sN+tumtGlwq+HvzFlLARUZ86134KFvg
+I2KE4yiktoS2KPP/zDNOYe0TiF6zXvfdLH/QtRvnzk4ZjjLMyvbIzIbtsR62p0XM
++WgNFE38jo07PPVnsVGIQuVaK2MkVrVWbtpg4wIDAQABAoIBAHw3wA3pnNXTLJGC
+fD1KfbZZjp9K76gyI10X6lsHow2i6dPiAah3LGecms4VkzfNdxcIW7303Kj3obZh
++ND277RnR6oPakgdXqdUCDP6OX2gemMFWqIWBkodhDmIOntmeHw4le4LwdiBD42B
+frBy0B5JCsbLPYPDmPNRGh8krvVS+Eir4hb4tK95TPMSL0vEjvHYFbCxv7//Ri1p
+3CROGp2CGX0WZ+Zs0crRNoIhRRM6kLAhROcqejtnEy6o7l5CWpCAL2vxlE9y8/kL
+iRawSZRFZnz/zGnqpx0vswgvijkuPfcNGMSzdwaiDgQz8D0GkJ7s9VgzZJazNy+1
+ET/4YIECgYEA612rwP9Ar9qdYbmmMPaJzITnaIrNGfO2JvaQqZt+DG8sVgdxL7V5
+D6emcw406drKRZvFAxnW6ZW2bVpmit02osl0re2A/nOTXLNuo338Qkap/hG8YZrF
+bw7w75pFa/rwlDtedjBnGHO2KbRXeU5Hn5wLoKjYgJoF6Ht+PPdL0IsCgYEA2lnC
+pQEhM51iRMDqNdmVJyvsTNU1ikoO8HaXHq+LwOQETaKMnDwp4Bn14E815CTulAc/
+tsDTKSDk6umZ+IufG1a2v7CqgKVwkB4HkgxKFQs2gQdTFfoMi5eeHR+njuNtklp1
+9fWfKHsP/ddrg+iTVTRZBLWexgKK89IMHYalpAkCgYEAy0Q3a9NF81mTJ+3kOE8C
+zO1OyLtuzGXsvxOb9c6C+owctyNwPeq05a89EgqH6hr5K0qOx9HOCCcyyJgVDQJl
+CAuByB/gkmAQOTQBbhMFA9vxPanljknTDsnRjKwoHkw2712ig+Hjd3ufK79C+FGB
+i7eBVzva1p2uUowshsxv3mcCgYAOFiRciMofjlO8o8V4W+Undcn02vxtQ4HbOYte
+S2z0sMEmUQpJOghpkMMwCWwsn8VUf3M40w/MY3bhQNjSFA/br6hyjW8yhXnRkl5i
+qbBN0z9c66AMlukgSFPHBTfGHB4Bhxx9Fa+C6Q2LDs6839BBevMTPrRTie509GQb
+s4gUIQKBgAvE8wLcmozno0GLDnBdKRZP/C7tmVnAINuraITPUBTASwI+Qo8ILigQ
+LRLaDqF84BEpjb8vdzkYFQqRQSZ8BI8NydfuKEFSBfL27sBvSGMYQJVm6bryUmPq
+T3ayaeZ4Wb3FFDijgtM9dRKyf7p4hQPOqM44QrntAtb43b2Q5L7M
+-----END RSA PRIVATE KEY-----
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/tasks/main.yml b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/tasks/main.yml
new file mode 100644
index 00000000..c5b7a23a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/integration/targets/setup_tls/tasks/main.yml
@@ -0,0 +1,21 @@
+---
+# Generated certificate with: https://github.com/michaelklishin/tls-gen
+# ~/tls-gen/basic# make PASSWORD=bunnies CN=ansible.tls.tests
+# verify with: make info
+
+- name: ensure target directory is present
+ file:
+ path: /tls
+ state: directory
+
+- name: ensure TLS files are present
+ copy:
+ src: "{{ item }}"
+ dest: "/tls/{{ item }}"
+ loop:
+ - ca_certificate.pem
+ - ca_key.pem
+ - client_certificate.pem
+ - client_key.pem
+ - server_certificate.pem
+ - server_key.pem
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.10.txt
new file mode 100644
index 00000000..3cf68c0d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.10.txt
@@ -0,0 +1 @@
+tests/utils/shippable/timing.py shebang
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.11.txt b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.11.txt
new file mode 100644
index 00000000..3cf68c0d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore-2.11.txt
@@ -0,0 +1 @@
+tests/utils/shippable/timing.py shebang
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore.txt b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore.txt
new file mode 100644
index 00000000..3cf68c0d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/sanity/ignore.txt
@@ -0,0 +1 @@
+tests/utils/shippable/timing.py shebang
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/__init__.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/__init__.py
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/builtins.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/builtins.py
new file mode 100644
index 00000000..f60ee678
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/builtins.py
@@ -0,0 +1,33 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+#
+# Compat for python2.7
+#
+
+# One unittest needs to import builtins via __import__() so we need to have
+# the string that represents it
+try:
+ import __builtin__
+except ImportError:
+ BUILTINS = 'builtins'
+else:
+ BUILTINS = '__builtin__'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/mock.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/mock.py
new file mode 100644
index 00000000..0972cd2e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/mock.py
@@ -0,0 +1,122 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python3.x's unittest.mock module
+'''
+import sys
+
+# Python 2.7
+
+# Note: Could use the pypi mock library on python3.x as well as python2.x. It
+# is the same as the python3 stdlib mock library
+
+try:
+ # Allow wildcard import because we really do want to import all of mock's
+ # symbols into this compat shim
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ from unittest.mock import *
+except ImportError:
+ # Python 2
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ try:
+ from mock import *
+ except ImportError:
+ print('You need the mock library installed on python2.x to run tests')
+
+
+# Prior to 3.4.4, mock_open cannot handle binary read_data
+if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
+ file_spec = None
+
+ def _iterate_read_data(read_data):
+ # Helper for mock_open:
+ # Retrieve lines from read_data via a generator so that separate calls to
+ # readline, read, and readlines are properly interleaved
+ sep = b'\n' if isinstance(read_data, bytes) else '\n'
+ data_as_list = [l + sep for l in read_data.split(sep)]
+
+ if data_as_list[-1] == sep:
+ # If the last line ended in a newline, the list comprehension will have an
+ # extra entry that's just a newline. Remove this.
+ data_as_list = data_as_list[:-1]
+ else:
+ # If there wasn't an extra newline by itself, then the file being
+ # emulated doesn't have a newline to end the last line remove the
+ # newline that our naive format() added
+ data_as_list[-1] = data_as_list[-1][:-1]
+
+ for line in data_as_list:
+ yield line
+
+ def mock_open(mock=None, read_data=''):
+ """
+ A helper function to create a mock to replace the use of `open`. It works
+ for `open` called directly or used as a context manager.
+
+ The `mock` argument is the mock object to configure. If `None` (the
+ default) then a `MagicMock` will be created for you, with the API limited
+ to methods or attributes available on standard file handles.
+
+ `read_data` is a string for the `read` methoddline`, and `readlines` of the
+ file handle to return. This is an empty string by default.
+ """
+ def _readlines_side_effect(*args, **kwargs):
+ if handle.readlines.return_value is not None:
+ return handle.readlines.return_value
+ return list(_data)
+
+ def _read_side_effect(*args, **kwargs):
+ if handle.read.return_value is not None:
+ return handle.read.return_value
+ return type(read_data)().join(_data)
+
+ def _readline_side_effect():
+ if handle.readline.return_value is not None:
+ while True:
+ yield handle.readline.return_value
+ for line in _data:
+ yield line
+
+ global file_spec
+ if file_spec is None:
+ import _io
+ file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
+
+ if mock is None:
+ mock = MagicMock(name='open', spec=open)
+
+ handle = MagicMock(spec=file_spec)
+ handle.__enter__.return_value = handle
+
+ _data = _iterate_read_data(read_data)
+
+ handle.write.return_value = None
+ handle.read.return_value = None
+ handle.readline.return_value = None
+ handle.readlines.return_value = None
+
+ handle.read.side_effect = _read_side_effect
+ handle.readline.side_effect = _readline_side_effect()
+ handle.readlines.side_effect = _readlines_side_effect
+
+ mock.return_value = handle
+ return mock
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/unittest.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/unittest.py
new file mode 100644
index 00000000..98f08ad6
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/compat/unittest.py
@@ -0,0 +1,38 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python2.7's unittest module
+'''
+
+import sys
+
+# Allow wildcard import because we really do want to import all of
+# unittests's symbols into this compat shim
+# pylint: disable=wildcard-import,unused-wildcard-import
+if sys.version_info < (2, 7):
+ try:
+ # Need unittest2 on python2.6
+ from unittest2 import *
+ except ImportError:
+ print('You need unittest2 installed on python2.6.x to run tests')
+else:
+ from unittest import *
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/__init__.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/__init__.py
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/loader.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/loader.py
new file mode 100644
index 00000000..0ee47fbb
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/loader.py
@@ -0,0 +1,116 @@
+# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import os
+
+from ansible.errors import AnsibleParserError
+from ansible.parsing.dataloader import DataLoader
+from ansible.module_utils._text import to_bytes, to_text
+
+
+class DictDataLoader(DataLoader):
+
+ def __init__(self, file_mapping=None):
+ file_mapping = {} if file_mapping is None else file_mapping
+ assert type(file_mapping) == dict
+
+ super(DictDataLoader, self).__init__()
+
+ self._file_mapping = file_mapping
+ self._build_known_directories()
+ self._vault_secrets = None
+
+ def load_from_file(self, path, cache=True, unsafe=False):
+ path = to_text(path)
+ if path in self._file_mapping:
+ return self.load(self._file_mapping[path], path)
+ return None
+
+ # TODO: the real _get_file_contents returns a bytestring, so we actually convert the
+ # unicode/text it's created with to utf-8
+ def _get_file_contents(self, path):
+ path = to_text(path)
+ if path in self._file_mapping:
+ return (to_bytes(self._file_mapping[path]), False)
+ else:
+ raise AnsibleParserError("file not found: %s" % path)
+
+ def path_exists(self, path):
+ path = to_text(path)
+ return path in self._file_mapping or path in self._known_directories
+
+ def is_file(self, path):
+ path = to_text(path)
+ return path in self._file_mapping
+
+ def is_directory(self, path):
+ path = to_text(path)
+ return path in self._known_directories
+
+ def list_directory(self, path):
+ ret = []
+ path = to_text(path)
+ for x in (list(self._file_mapping.keys()) + self._known_directories):
+ if x.startswith(path):
+ if os.path.dirname(x) == path:
+ ret.append(os.path.basename(x))
+ return ret
+
+ def is_executable(self, path):
+ # FIXME: figure out a way to make paths return true for this
+ return False
+
+ def _add_known_directory(self, directory):
+ if directory not in self._known_directories:
+ self._known_directories.append(directory)
+
+ def _build_known_directories(self):
+ self._known_directories = []
+ for path in self._file_mapping:
+ dirname = os.path.dirname(path)
+ while dirname not in ('/', ''):
+ self._add_known_directory(dirname)
+ dirname = os.path.dirname(dirname)
+
+ def push(self, path, content):
+ rebuild_dirs = False
+ if path not in self._file_mapping:
+ rebuild_dirs = True
+
+ self._file_mapping[path] = content
+
+ if rebuild_dirs:
+ self._build_known_directories()
+
+ def pop(self, path):
+ if path in self._file_mapping:
+ del self._file_mapping[path]
+ self._build_known_directories()
+
+ def clear(self):
+ self._file_mapping = dict()
+ self._known_directories = []
+
+ def get_basedir(self):
+ return os.getcwd()
+
+ def set_vault_secrets(self, vault_secrets):
+ self._vault_secrets = vault_secrets
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/path.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/path.py
new file mode 100644
index 00000000..e988116b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/path.py
@@ -0,0 +1,8 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible_collections.ansible.rabbitmq.tests.unit.compat.mock import MagicMock
+from ansible.utils.path import unfrackpath
+
+
+mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x)
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/procenv.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/procenv.py
new file mode 100644
index 00000000..56d44b01
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/procenv.py
@@ -0,0 +1,90 @@
+# (c) 2016, Matt Davis <mdavis@ansible.com>
+# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import sys
+import json
+
+from contextlib import contextmanager
+from io import BytesIO, StringIO
+from ansible_collections.ansible.rabbitmq.tests.unit.compat import unittest
+from ansible.module_utils.six import PY3
+from ansible.module_utils._text import to_bytes
+
+
+@contextmanager
+def swap_stdin_and_argv(stdin_data='', argv_data=tuple()):
+ """
+ context manager that temporarily masks the test runner's values for stdin and argv
+ """
+ real_stdin = sys.stdin
+ real_argv = sys.argv
+
+ if PY3:
+ fake_stream = StringIO(stdin_data)
+ fake_stream.buffer = BytesIO(to_bytes(stdin_data))
+ else:
+ fake_stream = BytesIO(to_bytes(stdin_data))
+
+ try:
+ sys.stdin = fake_stream
+ sys.argv = argv_data
+
+ yield
+ finally:
+ sys.stdin = real_stdin
+ sys.argv = real_argv
+
+
+@contextmanager
+def swap_stdout():
+ """
+ context manager that temporarily replaces stdout for tests that need to verify output
+ """
+ old_stdout = sys.stdout
+
+ if PY3:
+ fake_stream = StringIO()
+ else:
+ fake_stream = BytesIO()
+
+ try:
+ sys.stdout = fake_stream
+
+ yield fake_stream
+ finally:
+ sys.stdout = old_stdout
+
+
+class ModuleTestCase(unittest.TestCase):
+ def setUp(self, module_args=None):
+ if module_args is None:
+ module_args = {'_ansible_remote_tmp': '/tmp', '_ansible_keep_remote_files': False}
+
+ args = json.dumps(dict(ANSIBLE_MODULE_ARGS=module_args))
+
+ # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually
+ self.stdin_swap = swap_stdin_and_argv(stdin_data=args)
+ self.stdin_swap.__enter__()
+
+ def tearDown(self):
+ # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually
+ self.stdin_swap.__exit__(None, None, None)
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/vault_helper.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/vault_helper.py
new file mode 100644
index 00000000..dcce9c78
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/vault_helper.py
@@ -0,0 +1,39 @@
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible.module_utils._text import to_bytes
+
+from ansible.parsing.vault import VaultSecret
+
+
+class TextVaultSecret(VaultSecret):
+ '''A secret piece of text. ie, a password. Tracks text encoding.
+
+ The text encoding of the text may not be the default text encoding so
+ we keep track of the encoding so we encode it to the same bytes.'''
+
+ def __init__(self, text, encoding=None, errors=None, _bytes=None):
+ super(TextVaultSecret, self).__init__()
+ self.text = text
+ self.encoding = encoding or 'utf-8'
+ self._bytes = _bytes
+ self.errors = errors or 'strict'
+
+ @property
+ def bytes(self):
+ '''The text encoded with encoding, unless we specifically set _bytes.'''
+ return self._bytes or to_bytes(self.text, encoding=self.encoding, errors=self.errors)
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/yaml_helper.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/yaml_helper.py
new file mode 100644
index 00000000..1ef17215
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/mock/yaml_helper.py
@@ -0,0 +1,124 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import io
+import yaml
+
+from ansible.module_utils.six import PY3
+from ansible.parsing.yaml.loader import AnsibleLoader
+from ansible.parsing.yaml.dumper import AnsibleDumper
+
+
+class YamlTestUtils(object):
+ """Mixin class to combine with a unittest.TestCase subclass."""
+ def _loader(self, stream):
+ """Vault related tests will want to override this.
+
+ Vault cases should setup a AnsibleLoader that has the vault password."""
+ return AnsibleLoader(stream)
+
+ def _dump_stream(self, obj, stream, dumper=None):
+ """Dump to a py2-unicode or py3-string stream."""
+ if PY3:
+ return yaml.dump(obj, stream, Dumper=dumper)
+ else:
+ return yaml.dump(obj, stream, Dumper=dumper, encoding=None)
+
+ def _dump_string(self, obj, dumper=None):
+ """Dump to a py2-unicode or py3-string"""
+ if PY3:
+ return yaml.dump(obj, Dumper=dumper)
+ else:
+ return yaml.dump(obj, Dumper=dumper, encoding=None)
+
+ def _dump_load_cycle(self, obj):
+ # Each pass though a dump or load revs the 'generation'
+ # obj to yaml string
+ string_from_object_dump = self._dump_string(obj, dumper=AnsibleDumper)
+
+ # wrap a stream/file like StringIO around that yaml
+ stream_from_object_dump = io.StringIO(string_from_object_dump)
+ loader = self._loader(stream_from_object_dump)
+ # load the yaml stream to create a new instance of the object (gen 2)
+ obj_2 = loader.get_data()
+
+ # dump the gen 2 objects directory to strings
+ string_from_object_dump_2 = self._dump_string(obj_2,
+ dumper=AnsibleDumper)
+
+ # The gen 1 and gen 2 yaml strings
+ self.assertEqual(string_from_object_dump, string_from_object_dump_2)
+ # the gen 1 (orig) and gen 2 py object
+ self.assertEqual(obj, obj_2)
+
+ # again! gen 3... load strings into py objects
+ stream_3 = io.StringIO(string_from_object_dump_2)
+ loader_3 = self._loader(stream_3)
+ obj_3 = loader_3.get_data()
+
+ string_from_object_dump_3 = self._dump_string(obj_3, dumper=AnsibleDumper)
+
+ self.assertEqual(obj, obj_3)
+ # should be transitive, but...
+ self.assertEqual(obj_2, obj_3)
+ self.assertEqual(string_from_object_dump, string_from_object_dump_3)
+
+ def _old_dump_load_cycle(self, obj):
+ '''Dump the passed in object to yaml, load it back up, dump again, compare.'''
+ stream = io.StringIO()
+
+ yaml_string = self._dump_string(obj, dumper=AnsibleDumper)
+ self._dump_stream(obj, stream, dumper=AnsibleDumper)
+
+ yaml_string_from_stream = stream.getvalue()
+
+ # reset stream
+ stream.seek(0)
+
+ loader = self._loader(stream)
+ # loader = AnsibleLoader(stream, vault_password=self.vault_password)
+ obj_from_stream = loader.get_data()
+
+ stream_from_string = io.StringIO(yaml_string)
+ loader2 = self._loader(stream_from_string)
+ # loader2 = AnsibleLoader(stream_from_string, vault_password=self.vault_password)
+ obj_from_string = loader2.get_data()
+
+ stream_obj_from_stream = io.StringIO()
+ stream_obj_from_string = io.StringIO()
+
+ if PY3:
+ yaml.dump(obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper)
+ yaml.dump(obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper)
+ else:
+ yaml.dump(obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper, encoding=None)
+ yaml.dump(obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper, encoding=None)
+
+ yaml_string_stream_obj_from_stream = stream_obj_from_stream.getvalue()
+ yaml_string_stream_obj_from_string = stream_obj_from_string.getvalue()
+
+ stream_obj_from_stream.seek(0)
+ stream_obj_from_string.seek(0)
+
+ if PY3:
+ yaml_string_obj_from_stream = yaml.dump(obj_from_stream, Dumper=AnsibleDumper)
+ yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper)
+ else:
+ yaml_string_obj_from_stream = yaml.dump(obj_from_stream, Dumper=AnsibleDumper, encoding=None)
+ yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper, encoding=None)
+
+ assert yaml_string == yaml_string_obj_from_stream
+ assert yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string
+ assert (yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string == yaml_string_stream_obj_from_stream ==
+ yaml_string_stream_obj_from_string)
+ assert obj == obj_from_stream
+ assert obj == obj_from_string
+ assert obj == yaml_string_obj_from_stream
+ assert obj == yaml_string_obj_from_string
+ assert obj == obj_from_stream == obj_from_string == yaml_string_obj_from_stream == yaml_string_obj_from_string
+ return {'obj': obj,
+ 'yaml_string': yaml_string,
+ 'yaml_string_from_stream': yaml_string_from_stream,
+ 'obj_from_stream': obj_from_stream,
+ 'obj_from_string': obj_from_string,
+ 'yaml_string_obj_from_string': yaml_string_obj_from_string}
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/__init__.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/__init__.py
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/rabbitmq_user_fixtures.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/rabbitmq_user_fixtures.py
new file mode 100644
index 00000000..c2b8925a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/rabbitmq_user_fixtures.py
@@ -0,0 +1,181 @@
+rabbitmq_3_6_status = '''
+Status of node rabbit@vagrant
+[{pid,5519},
+ {running_applications,
+ [{rabbit,"RabbitMQ","version_num"},
+ {mnesia,"MNESIA CXC 138 12","4.15.3"},
+ {ranch,"Socket acceptor pool for TCP protocols.","1.3.0"},
+ {ssl,"Erlang/OTP SSL application","8.2.3"},
+ {public_key,"Public key infrastructure","1.5.2"},
+ {asn1,"The Erlang ASN1 compiler version 5.0.4","5.0.4"},
+ {rabbit_common,
+ "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
+ "3.6.10"},
+ {xmerl,"XML parser","1.3.16"},
+ {crypto,"CRYPTO","4.2"},
+ {compiler,"ERTS CXC 138 10","7.1.4"},
+ {os_mon,"CPO CXC 138 46","2.4.4"},
+ {syntax_tools,"Syntax tools","2.1.4"},
+ {sasl,"SASL CXC 138 11","3.1.1"},
+ {stdlib,"ERTS CXC 138 10","3.4.3"},
+ {kernel,"ERTS CXC 138 10","5.4.1"}]},
+ {os,{unix,linux}},
+ {erlang_version,
+ "Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64] [kernel-poll:true]\n"},
+ {memory,
+ [{total,49712064},
+ {connection_readers,0},
+ {connection_writers,0},
+ {connection_channels,0},
+ {connection_other,0},
+ {queue_procs,2744},
+ {queue_slave_procs,0},
+ {plugins,0},
+ {other_proc,17493000},
+ {mnesia,65128},
+ {metrics,184272},
+ {mgmt_db,0},
+ {msg_index,41832},
+ {other_ets,1766176},
+ {binary,43576},
+ {code,21390833},
+ {atom,891849},
+ {other_system,8014118}]},
+ {alarms,[]},
+ {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
+ {vm_memory_high_watermark,0.4},
+ {vm_memory_limit,413340467},
+ {disk_free_limit,50000000},
+ {disk_free,61216505856},
+ {file_descriptors,
+ [{total_limit,65436},
+ {total_used,2},
+ {sockets_limit,58890},
+ {sockets_used,0}]},
+ {processes,[{limit,1048576},{used,153}]},
+ {run_queue,0},
+ {uptime,1795},
+ {kernel,{net_ticktime,60}}]
+root@vagrant:/home/vagrant# rabbitmqctl -q status
+[{pid,5519},
+ {running_applications,
+ [{rabbit,"RabbitMQ","3.6.10"},
+ {mnesia,"MNESIA CXC 138 12","4.15.3"},
+ {ranch,"Socket acceptor pool for TCP protocols.","1.3.0"},
+ {ssl,"Erlang/OTP SSL application","8.2.3"},
+ {public_key,"Public key infrastructure","1.5.2"},
+ {asn1,"The Erlang ASN1 compiler version 5.0.4","5.0.4"},
+ {rabbit_common,
+ "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
+ "3.6.10"},
+ {xmerl,"XML parser","1.3.16"},
+ {crypto,"CRYPTO","4.2"},
+ {compiler,"ERTS CXC 138 10","7.1.4"},
+ {os_mon,"CPO CXC 138 46","2.4.4"},
+ {syntax_tools,"Syntax tools","2.1.4"},
+ {sasl,"SASL CXC 138 11","3.1.1"},
+ {stdlib,"ERTS CXC 138 10","3.4.3"},
+ {kernel,"ERTS CXC 138 10","5.4.1"}]},
+ {os,{unix,linux}},
+ {erlang_version,
+ "Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64] [kernel-poll:true]\n"},
+ {memory,
+ [{total,49770912},
+ {connection_readers,0},
+ {connection_writers,0},
+ {connection_channels,0},
+ {connection_other,0},
+ {queue_procs,2744},
+ {queue_slave_procs,0},
+ {plugins,0},
+ {other_proc,17554528},
+ {mnesia,65128},
+ {metrics,184272},
+ {mgmt_db,0},
+ {msg_index,41832},
+ {other_ets,1766176},
+ {binary,42816},
+ {code,21390833},
+ {atom,891849},
+ {other_system,8012198}]},
+ {alarms,[]},
+ {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
+ {vm_memory_high_watermark,0.4},
+ {vm_memory_limit,413340467},
+ {disk_free_limit,50000000},
+ {disk_free,61216497664},
+ {file_descriptors,
+ [{total_limit,65436},
+ {total_used,2},
+ {sockets_limit,58890},
+ {sockets_used,0}]},
+ {processes,[{limit,1048576},{used,153}]},
+ {run_queue,0},
+ {uptime,17139},
+ {kernel,{net_ticktime,60}}]'''
+
+rabbitmq_3_7_status = \
+ '{"pid":31701,"running_applications":[' \
+ '["rabbit",[82,97,98,98,105,116,77,81],version_num],' \
+ '["rabbit_common",[77,111,100,117,108,101,115,32,115,104,97,114,101,100,32,98,121,32,114,97,98,98,105,116,109,' \
+ '113,45,115,101,114,118,101,114,32,97,110,100,32,114,97,98,98,105,116,109,113,45,101,114,108,97,110,103,45,99,' \
+ '108,105,101,110,116],[51,46,55,46,54]],' \
+ '["ranch_proxy_protocol",[82,97,110,99,104,32,80,114,111,120,121,32,80,114,111,116,111,99,111,108,32,84,114,97,' \
+ '110,115,112,111,114,116],[49,46,53,46,48]],' \
+ '["ranch",[83,111,99,107,101,116,32,97,99,99,101,112,116,111,114,32,112,111,111,108,32,102,111,114,32,84,67,80,' \
+ '32,112,114,111,116,111,99,111,108,115,46],[49,46,53,46,48]],["ssl",[69,114,108,97,110,103,47,79,84,80,32,83,83,' \
+ '76,32,97,112,112,108,105,99,97,116,105,111,110],[56,46,50,46,51]],' \
+ '["public_key",[80,117,98,108,105,99,32,107,101,121,32,105,110,102,114,97,115,116,114,117,99,116,117,114,101],' \
+ '[49,46,53,46,50]],' \
+ '["asn1",[84,104,101,32,69,114,108,97,110,103,32,65,83,78,49,32,99,111,109,112,105,108,101,114,32,118,101,114,' \
+ '115,105,111,110,32,53,46,48,46,52],[53,46,48,46,52]],' \
+ '["crypto",[67,82,89,80,84,79],[52,46,50]],["xmerl",[88,77,76,32,112,97,114,115,101,114],[49,46,51,46,49,54]],' \
+ '["recon",[68,105,97,103,110,111,115,116,105,99,32,116,111,111,108,115,32,102,111,114,32,112,114,111,100,117,99,' \
+ '116,105,111,110,32,117,115,101],[50,46,51,46,50]],' \
+ '["inets",[73,78,69,84,83,32,32,67,88,67,32,49,51,56,32,52,57],[54,46,52,46,53]],' \
+ '["jsx",[97,32,115,116,114,101,97,109,105,110,103,44,32,101,118,101,110,116,101,100,32,106,115,111,110,32,112,97,' \
+ '114,115,105,110,103,32,116,111,111,108,107,105,116],[50,46,56,46,50]],["os_mon",[67,80,79,32,32,67,88,67,32,49,' \
+ '51,56,32,52,54],[50,46,52,46,52]],' \
+ '["mnesia",[77,78,69,83,73,65,32,32,67,88,67,32,49,51,56,32,49,50],[52,46,49,53,46,51]],' \
+ '["lager",[69,114,108,97,110,103,32,108,111,103,103,105,110,103,32,102,114,97,109,101,119,111,114,107],' \
+ '[51,46,53,46,49]],' \
+ '["goldrush",[69,114,108,97,110,103,32,101,118,101,110,116,32,115,116,114,101,97,109,32,112,114,111,99,101,115,' \
+ '115,111,114],[48,46,49,46,57]],["compiler",[69,82,84,83,32,32,67,88,67,32,49,51,56,32,49,48],[55,46,49,46,52]],' \
+ '["syntax_tools",[83,121,110,116,97,120,32,116,111,111,108,115],[50,46,49,46,52]],' \
+ '["syslog",[65,110,32,82,70,67,32,51,49,54,52,32,97,110,100,32,82,70,67,32,53,52,50,52,32,99,111,109,112,108,' \
+ '105,97,110,116,32,108,111,103,103,105,110,103,32,102,114,97,109,101,119,111,114,107,46],[51,46,52,46,50]],' \
+ '["sasl",[83,65,83,76,32,32,67,88,67,32,49,51,56,32,49,49],[51,46,49,46,49]],' \
+ '["stdlib",[69,82,84,83,32,32,67,88,67,32,49,51,56,32,49,48],[51,46,52,46,51]],' \
+ '["kernel",[69,82,84,83,32,32,67,88,67,32,49,51,56,32,49,48],[53,46,52,46,49]]],' \
+ '"os":["unix","linux"],"erlang_version":[69,114,108,97,110,103,47,79,84,80,32,50,48,32,91,101,114,116,115,45,57,' \
+ '46,50,93,32,91,115,111,117,114,99,101,93,32,91,54,52,45,98,105,116,93,32,91,115,109,112,58,49,58,49,93,32,91,' \
+ '100,115,58,49,58,49,58,49,48,93,32,91,97,115,121,110,99,45,116,104,114,101,97,100,115,58,54,52,93,32,91,107,' \
+ '101,114,110,101,108,45,112,111,108,108,58,116,114,117,101,93,10],' \
+ '"memory":{"connection_readers":0,"connection_writers":0,"connection_channels":0,' \
+ '"connection_other":0,"queue_procs":0,"queue_slave_procs":0,"plugins":5736,"other_proc":23159832,' \
+ '"metrics":184608,"mgmt_db":0,"mnesia":76896,"other_ets":1882856,"binary":64120,"msg_index":57184,' \
+ '"code":24981937,"atom":1041593,"other_system":8993494,"allocated_unused":13066752,"reserved_unallocated":0,' \
+ '"strategy":"rss","total":{"erlang":60448256,"rss":72720384,"allocated":73515008}},"alarms":[],' \
+ '"listeners":[["clustering",25672,[58,58]],["amqp",5672,[58,58]]],"vm_memory_calculation_strategy":"rss",' \
+ '"vm_memory_high_watermark":0.4,"vm_memory_limit":413340467,"disk_free_limit":50000000,"disk_free":61108576256,' \
+ '"file_descriptors":{"total_limit":924,"total_used":4,"sockets_limit":829,"sockets_used":0},' \
+ '"processes":{"limit":1048576,"used":214},"run_queue":0,"uptime":173,"kernel":["net_ticktime",60]}'
+
+rabbitmq_3_8_status = \
+ '{"active_plugins":[],"alarms":[],"config_files":[],"data_directory":"/var/lib/rabbitmq/mnesia/rabbit@vagrant",' \
+ '"disk_free":60898615296,"disk_free_limit":50000000,"enabled_plugin_file":"/etc/rabbitmq/enabled_plugins",' \
+ '"erlang_version":"Erlang/OTP 21 [erts-10.3.5.8] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64]",' \
+ '"file_descriptors":{"sockets_limit":29399,"sockets_used":0,"total_limit":32668,"total_used":4},' \
+ '"listeners":[{"interface":"[::]","node":"rabbit@vagrant","port":25672,"protocol":"clustering",' \
+ '"purpose":"inter-node and CLI tool communication"},{"interface":"[::]","node":"rabbit@vagrant",' \
+ '"port":5672,"protocol":"amqp","purpose":"AMQP 0-9-1 and AMQP 1.0"}],' \
+ '"log_files":["/var/log/rabbitmq/rabbit@vagrant.log","/var/log/rabbitmq/rabbit@vagrant_upgrade.log"],' \
+ '"memory":{"allocated_unused":14962432,"atom":1180881,"binary":82304,"code":26631176,"connection_channels":0,' \
+ '"connection_other":0,"connection_readers":0,"connection_writers":0,"metrics":195308,"mgmt_db":0,"mnesia":76896,' \
+ '"msg_index":57088,"other_ets":2666736,"other_proc":25333896,"other_system":10068879,"plugins":11732,' \
+ '"queue_procs":0,"queue_slave_procs":0,"quorum_ets":42368,"quorum_queue_procs":0,"reserved_unallocated":0,' \
+ '"strategy":"rss","total":{"erlang":66347264,"rss":80506880,"allocated":81309696}},"net_ticktime":60,' \
+ '"os":"Linux","pid":9829,"processes":{"limit":1048576,"used":259},"rabbitmq_version":"version_num","run_queue":1,' \
+ '"totals":{"virtual_host_count":2,"connection_count":0,"queue_count":0},"uptime":66,' \
+ '"vm_memory_calculation_strategy":"rss","vm_memory_high_watermark_limit":413340467,' \
+ '"vm_memory_high_watermark_setting":{"relative":0.4}}'
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/test_rabbitmq_user.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/test_rabbitmq_user.py
new file mode 100644
index 00000000..8cc529ed
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/messaging/rabbitmq/test_rabbitmq_user.py
@@ -0,0 +1,357 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import distutils.version
+
+from ansible_collections.community.rabbitmq.plugins.modules import rabbitmq_user
+from ansible.module_utils import six
+from itertools import chain
+
+if six.PY3:
+ from itertools import zip_longest
+else:
+ from itertools import izip_longest as zip_longest
+
+from ansible_collections.community.rabbitmq.tests.unit.compat.mock import patch
+from ansible_collections.community.rabbitmq.tests.unit.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
+
+from ansible_collections.community.rabbitmq.tests.unit.modules.messaging.rabbitmq.rabbitmq_user_fixtures import (
+ rabbitmq_3_6_status,
+ rabbitmq_3_7_status,
+ rabbitmq_3_8_status)
+
+
+def flatten(args):
+ return list(chain(*args))
+
+
+def lists_equal(l1, l2):
+ return all(map(lambda t: t[0] == t[1], zip_longest(l1, l2)))
+
+
+class TestRabbitMQUserModule(ModuleTestCase):
+ def setUp(self):
+ super(TestRabbitMQUserModule, self).setUp()
+ self.module = rabbitmq_user
+
+ def tearDown(self):
+ super(TestRabbitMQUserModule, self).tearDown()
+
+ def _assert(self, exc, attribute, expected_value, msg=''):
+ value = exc.message[attribute] if hasattr(exc, attribute) else exc.args[0][attribute]
+ assert value == expected_value, msg
+
+ def test_without_required_parameters(self):
+ """Failure must occur when all parameters are missing."""
+ with self.assertRaises(AnsibleFailJson):
+ set_module_args({})
+ self.module.main()
+
+ @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ def test_permissions_with_same_vhost(self, _check_version, get_bin_path):
+ set_module_args({
+ 'user': 'someuser',
+ 'password': 'somepassword',
+ 'state': 'present',
+ 'permissions': [{'vhost': '/'}, {'vhost': '/'}],
+ })
+ _check_version.return_value = distutils.version.StrictVersion('3.6.10')
+ get_bin_path.return_value = '/rabbitmqctl'
+ try:
+ self.module.main()
+ except AnsibleFailJson as e:
+ self._assert(e, 'failed', True)
+ self._assert(e, 'msg', "Error parsing vhost "
+ "permissions: You can't have two permission dicts for the same vhost")
+
+ @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.get')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.check_password')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.has_tags_modifications')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.has_permissions_modifications')
+ def test_password_changes_only_when_needed(self,
+ has_permissions_modifications,
+ has_tags_modifications,
+ check_password,
+ _check_version,
+ get,
+ get_bin_path):
+ set_module_args({
+ 'user': 'someuser',
+ 'password': 'somepassword',
+ 'state': 'present',
+ 'update_password': 'always',
+ })
+ get.return_value = True
+ _check_version.return_value = distutils.version.StrictVersion('3.6.10')
+ get_bin_path.return_value = '/rabbitmqctl'
+ check_password.return_value = True
+ has_tags_modifications.return_value = False
+ has_permissions_modifications.return_value = False
+ try:
+ self.module.main()
+ except AnsibleExitJson as e:
+ self._assert(e, 'changed', False)
+ self._assert(e, 'state', 'present')
+
+ @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._exec')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._get_permissions')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.has_tags_modifications')
+ def test_same_permissions_not_changing(self,
+ has_tags_modifications,
+ _get_permissions,
+ _check_version,
+ _exec,
+ get_bin_path):
+ set_module_args({
+ 'user': 'someuser',
+ 'password': 'somepassword',
+ 'state': 'present',
+ 'permissions': [{'vhost': '/', 'configure_priv': '.*', 'write_priv': '.*', 'read_priv': '.*'}],
+ })
+ _get_permissions.return_value = {'/': {'read': '.*', 'write': '.*', 'configure': '.*', 'vhost': '/'}}
+ _exec.return_value = 'someuser\t[]'
+ _check_version.return_value = distutils.version.StrictVersion('3.6.10')
+ get_bin_path.return_value = '/rabbitmqctl'
+ has_tags_modifications.return_value = False
+ try:
+ self.module.main()
+ except AnsibleExitJson as e:
+ self._assert(e, 'changed', False)
+ self._assert(e, 'state', 'present')
+
+ @patch('ansible.module_utils.basic.AnsibleModule')
+ def test_status_can_be_parsed(self, module):
+ """Test correct parsing of the output of the status command."""
+ module.get_bin_path.return_value = '/rabbitmqctl'
+ module.check_mode = False
+
+ versions = ['3.6.10', '3.6.16']
+ for version_num in versions:
+ def side_effect(args):
+ assert '-q' in args
+ if '--formatter' in args:
+ return 64, '', ''
+ return 0, rabbitmq_3_6_status.replace('version_num', version_num), ''
+
+ module.run_command.side_effect = side_effect
+ user_controller = rabbitmq_user.RabbitMqUser(module, 'someuser', 'somepassword', list(), list(), 'rabbit')
+ self.assertEqual(len(module.run_command.call_args_list), 2)
+ last_call_args = flatten(module.run_command.call_args_list[-1][0])
+ self.assertTrue('-q' in last_call_args)
+ self.assertTrue('--formatter' not in last_call_args)
+ self.assertEqual(user_controller._version, distutils.version.StrictVersion(version_num))
+ module.run_command.reset_mock()
+
+ versions = ['3.7.6', '3.7.7', '3.7.8', '3.7.9', '3.7.10', '3.7.11', '3.7.12', '3.7.13', '3.7.14', '3.7.15',
+ '3.7.16', '3.7.17', '3.7.18', '3.7.19', '3.7.20', '3.7.21', '3.7.22', '3.7.23']
+ for version_num in versions:
+ def side_effect(args):
+ self.assertTrue('-q' in args)
+ self.assertTrue('--formatter' in args)
+ self.assertTrue('json' in args)
+ return 0, rabbitmq_3_7_status.replace('version_num', str([ord(c) for c in version_num])), ''
+
+ module.run_command.side_effect = side_effect
+ user_controller = rabbitmq_user.RabbitMqUser(module, 'someuser', 'somepassword', list(), list(), 'rabbit')
+ self.assertEqual(1, module.run_command.call_count)
+ self.assertEqual(user_controller._version, distutils.version.StrictVersion(version_num))
+ module.run_command.reset_mock()
+
+ versions = ['3.8.0', '3.8.1', '3.8.2']
+ for version_num in versions:
+ def side_effect(args):
+ self.assertTrue('-q' in args)
+ self.assertTrue('--formatter' in args)
+ self.assertTrue('json' in args)
+ return 0, rabbitmq_3_8_status.replace('version_num', version_num), ''
+
+ module.run_command.side_effect = side_effect
+ user_controller = rabbitmq_user.RabbitMqUser(module, 'someuser', 'somepassword', list(), list(), 'rabbit')
+ self.assertEqual(1, module.run_command.call_count)
+ self.assertEqual(user_controller._version, distutils.version.StrictVersion(version_num))
+ module.run_command.reset_mock()
+
+ @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._exec')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._get_permissions')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser.has_tags_modifications')
+ def test_permissions_are_fixed(self,
+ has_tags_modifications,
+ _get_permissions,
+ _check_version,
+ _exec,
+ get_bin_path):
+ """Test changes in permissions are fixed.
+
+ Ensure that permissions that do not need to be changed are not, permissions with differences are
+ fixed and permissions are cleared when needed, with the minimum number of operations. The
+ permissions are fed into the module using the pre-3.7 version format.
+ """
+ set_module_args({
+ 'user': 'someuser',
+ 'password': 'somepassword',
+ 'state': 'present',
+ 'permissions': [
+ {'vhost': '/', 'configure_priv': '.*', 'write_priv': '.*', 'read_priv': '.*'},
+ {'vhost': '/ok', 'configure': '^$', 'write': '^$', 'read': '^$'}
+ ],
+ })
+ get_bin_path.return_value = '/rabbitmqctl'
+ has_tags_modifications.return_value = False
+ _check_version.return_value = distutils.version.StrictVersion('3.6.10')
+ _get_permissions.return_value = {
+ '/wrong_vhost': {'vhost': '/wrong_vhost', 'configure': '', 'write': '', 'read': ''},
+ '/ok': {'vhost': '/ok', 'configure': '^$', 'write': '^$', 'read': '^$'}
+ }
+
+ def side_effect(args):
+ if 'list_users' in args:
+ self.assertTrue('--formatter' not in args)
+ self.assertTrue('json' not in args)
+ return 'someuser\t[administrator, management]'
+ if 'clear_permissions' in args:
+ self.assertTrue('someuser' in args)
+ self.assertTrue('/wrong_vhost' in args)
+ return ''
+ if 'set_permissions' in args:
+ self.assertTrue('someuser' in args)
+ self.assertTrue('/' in args)
+ self.assertTrue(['.*', '.*', '.*'] == args[-3:])
+ return ''
+ _exec.side_effect = side_effect
+
+ try:
+ self.module.main()
+ except AnsibleExitJson as e:
+ self._assert(e, 'changed', True)
+ self._assert(e, 'state', 'present')
+ self.assertEqual(_exec.call_count, 3)
+ self.assertTrue(['clear_permissions', '-p', '/wrong_vhost', 'someuser'] ==
+ flatten(_exec.call_args_list[-2][0]))
+ self.assertTrue(['set_permissions', '-p', '/', 'someuser', '.*', '.*', '.*'] ==
+ flatten(_exec.call_args_list[-1][0]))
+
+ @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._exec')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._get_permissions')
+ def test_tags_are_fixed(self, _get_permissions, _check_version, _exec, get_bin_path):
+ """Test user tags are fixed."""
+ set_module_args({
+ 'user': 'someuser',
+ 'password': 'somepassword',
+ 'state': 'present',
+ 'tags': 'tag1,tags2',
+ })
+ get_bin_path.return_value = '/rabbitmqctl'
+ _check_version.return_value = distutils.version.StrictVersion('3.6.10')
+ _get_permissions.return_value = {'/': {'vhost': '/', 'configure': '^$', 'write': '^$', 'read': '^$'}}
+
+ def side_effect(args):
+ if 'list_users' in args:
+ self.assertTrue('--formatter' not in args)
+ self.assertTrue('json' not in args)
+ return 'someuser\t[tag1, tag3]'
+ return ''
+ _exec.side_effect = side_effect
+
+ try:
+ self.module.main()
+ except AnsibleExitJson as e:
+ self._assert(e, 'changed', True)
+ self._assert(e, 'state', 'present')
+ self.assertEqual(_exec.call_count, 2)
+ self.assertTrue(lists_equal(['set_user_tags', 'someuser', 'tag1', 'tags2'],
+ flatten(_exec.call_args_list[-1][0])))
+
+ @patch('ansible.module_utils.basic.AnsibleModule')
+ def test_user_json_data_can_be_parsed(self, module):
+ """Ensure that user json data can be parsed.
+
+ From version 3.7 onwards `rabbitmqctl` can output the user data in proper json format. Check that parsing
+ works correctly.
+ """
+
+ def side_effect(args):
+ self.assertTrue('-q' in args)
+ self.assertTrue('--formatter' in args)
+ self.assertTrue('json' in args)
+ if 'status' in args:
+ return 0, rabbitmq_3_8_status.replace('version_num', '3.8.1'), ''
+ if 'list_users' in args:
+ return 0, '''[
+{"user":"someuser","tags":["administrator","management"]}
+]''', ''
+ if 'list_user_permissions' in args:
+ return 0, '''[
+{"vhost":"/test","configure":"^$","write":"^$","read":"^$"}
+,{"vhost":"/","configure":"^$","write":"^$","read":"^$"}
+]''', ''
+ return 100, '', ''
+
+ module.run_command.side_effect = side_effect
+ user_controller = rabbitmq_user.RabbitMqUser(
+ module, 'someuser', 'somepassword', list(),
+ [{'vhost': '/', 'configure': '^$', 'write': '^$', 'read': '^$'}], 'rabbit',
+ bulk_permissions=True)
+ self.assertTrue(user_controller.get())
+ self.assertTrue(user_controller._version, distutils.version.StrictVersion('3.8.1'))
+ self.assertTrue(user_controller.existing_tags, ["administrator", "management"])
+ self.assertTrue(user_controller.existing_permissions == {
+ '/test': {'vhost': '/test', 'configure': '^$', 'write': '^$', 'read': '^$'},
+ '/': {'vhost': '/', 'configure': '^$', 'write': '^$', 'read': '^$'}})
+ self.assertEqual(module.run_command.call_count, 3)
+
+ @patch('ansible.module_utils.basic.AnsibleModule')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._exec')
+ @patch('ansible_collections.community.rabbitmq.plugins.modules.rabbitmq_user.RabbitMqUser._check_version')
+ def test_non_bulk_permissions_are_parsed_and_set(self, _check_version, _exec, module):
+ """Test that non bulk permissions are parsed correctly.
+
+ Non-bulk permissions mean that only the permissions of the VHost specified will be changed if needed.
+ If the same user has permissions in other VHosts, these will not be modified.
+ """
+ module.get_bin_path.return_value = '/rabbitmqctl'
+ module.check_mode = False
+ _check_version.return_value = distutils.version.StrictVersion('3.8.0')
+
+ def side_effect(args):
+ self.assertTrue('--formatter' in args, args)
+ self.assertTrue('json' in args, args)
+ if 'list_users' in args:
+ return '''[
+{"user":"someuser","tags":["administrator","management"]}
+]'''
+ if 'list_user_permissions' in args:
+ self.assertTrue('someuser' in args, args)
+ return '''[
+{"vhost":"/test","configure":"^$","write":"^$","read":"^$"}
+,{"vhost":"/","configure":"^$","write":"^$","read":"^$"}
+]'''
+ raise Exception('wrong command: ' + str(args))
+
+ _exec.side_effect = side_effect
+ user_controller = rabbitmq_user.RabbitMqUser(
+ module, 'someuser', 'somepassword', list(), [{
+ 'vhost': '/',
+ 'configure_priv': '.*',
+ 'write_priv': '.*',
+ 'read_priv': '.*'
+ }], 'rabbit'
+ )
+ user_controller.get()
+
+ self.assertEqual(_exec.call_count, 2)
+ self.assertListEqual(list(user_controller.existing_permissions.keys()), ['/'])
+ self.assertEqual(user_controller.existing_permissions['/']['write'], '^$')
+ self.assertEqual(user_controller.existing_permissions['/']['read'], '^$')
+ self.assertEqual(user_controller.existing_permissions['/']['configure'], '^$')
+ self.assertTrue(user_controller.has_permissions_modifications())
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/utils.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/utils.py
new file mode 100644
index 00000000..6261a177
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/unit/modules/utils.py
@@ -0,0 +1,50 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import json
+
+from ansible_collections.community.rabbitmq.tests.unit.compat import unittest
+from ansible_collections.community.rabbitmq.tests.unit.compat.mock import patch
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+
+
+def set_module_args(args):
+ if '_ansible_remote_tmp' not in args:
+ args['_ansible_remote_tmp'] = '/tmp'
+ if '_ansible_keep_remote_files' not in args:
+ args['_ansible_keep_remote_files'] = False
+
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args)
+
+
+class AnsibleExitJson(Exception):
+ pass
+
+
+class AnsibleFailJson(Exception):
+ pass
+
+
+def exit_json(*args, **kwargs):
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs):
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class ModuleTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.mock_module = patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
+ self.mock_module.start()
+ self.mock_sleep = patch('time.sleep')
+ self.mock_sleep.start()
+ set_module_args({})
+ self.addCleanup(self.mock_module.stop)
+ self.addCleanup(self.mock_sleep.stop)
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/check_matrix.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/check_matrix.py
new file mode 100755
index 00000000..c9b0462f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/check_matrix.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+"""Verify the currently executing Shippable test matrix matches the one defined in the "shippable.yml" file."""
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import datetime
+import json
+import os
+import re
+import sys
+import time
+
+from ansible.module_utils.urls import open_url
+
+try:
+ from typing import NoReturn
+except ImportError:
+ NoReturn = None
+
+
+def main(): # type: () -> None
+ """Main entry point."""
+ repo_full_name = os.environ['REPO_FULL_NAME']
+ required_repo_full_name = 'ansible-collections/general'
+
+ if repo_full_name != required_repo_full_name:
+ sys.stderr.write('Skipping matrix check on repo "%s" which is not "%s".\n' % (repo_full_name, required_repo_full_name))
+ return
+
+ with open('shippable.yml', 'rb') as yaml_file:
+ yaml = yaml_file.read().decode('utf-8').splitlines()
+
+ defined_matrix = [match.group(1) for match in [re.search(r'^ *- env: T=(.*)$', line) for line in yaml] if match and match.group(1) != 'none']
+
+ if not defined_matrix:
+ fail('No matrix entries found in the "shippable.yml" file.',
+ 'Did you modify the "shippable.yml" file?')
+
+ run_id = os.environ['SHIPPABLE_BUILD_ID']
+ sleep = 1
+ jobs = []
+
+ for attempts_remaining in range(4, -1, -1):
+ try:
+ jobs = json.loads(open_url('https://api.shippable.com/jobs?runIds=%s' % run_id).read())
+
+ if not isinstance(jobs, list):
+ raise Exception('Shippable run %s data is not a list.' % run_id)
+
+ break
+ except Exception as ex:
+ if not attempts_remaining:
+ fail('Unable to retrieve Shippable run %s matrix.' % run_id,
+ str(ex))
+
+ sys.stderr.write('Unable to retrieve Shippable run %s matrix: %s\n' % (run_id, ex))
+ sys.stderr.write('Trying again in %d seconds...\n' % sleep)
+ time.sleep(sleep)
+ sleep *= 2
+
+ if len(jobs) != len(defined_matrix):
+ if len(jobs) == 1:
+ hint = '\n\nMake sure you do not use the "Rebuild with SSH" option.'
+ else:
+ hint = ''
+
+ fail('Shippable run %s has %d jobs instead of the expected %d jobs.' % (run_id, len(jobs), len(defined_matrix)),
+ 'Try re-running the entire matrix.%s' % hint)
+
+ actual_matrix = dict((job.get('jobNumber'), dict(tuple(line.split('=', 1)) for line in job.get('env', [])).get('T', '')) for job in jobs)
+ errors = [(job_number, test, actual_matrix.get(job_number)) for job_number, test in enumerate(defined_matrix, 1) if actual_matrix.get(job_number) != test]
+
+ if len(errors):
+ error_summary = '\n'.join('Job %s expected "%s" but found "%s" instead.' % (job_number, expected, actual) for job_number, expected, actual in errors)
+
+ fail('Shippable run %s has a job matrix mismatch.' % run_id,
+ 'Try re-running the entire matrix.\n\n%s' % error_summary)
+
+
+def fail(message, output): # type: (str, str) -> NoReturn
+ # Include a leading newline to improve readability on Shippable "Tests" tab.
+ # Without this, the first line becomes indented.
+ output = '\n' + output.strip()
+
+ timestamp = datetime.datetime.utcnow().replace(microsecond=0).isoformat()
+
+ # hack to avoid requiring junit-xml, which isn't pre-installed on Shippable outside our test containers
+ xml = '''
+<?xml version="1.0" encoding="utf-8"?>
+<testsuites disabled="0" errors="1" failures="0" tests="1" time="0.0">
+\t<testsuite disabled="0" errors="1" failures="0" file="None" log="None" name="ansible-test" skipped="0" tests="1" time="0" timestamp="%s" url="None">
+\t\t<testcase classname="timeout" name="timeout">
+\t\t\t<error message="%s" type="error">%s</error>
+\t\t</testcase>
+\t</testsuite>
+</testsuites>
+''' % (timestamp, message, output)
+
+ path = 'shippable/testresults/check-matrix.xml'
+ dir_path = os.path.dirname(path)
+
+ if not os.path.exists(dir_path):
+ os.makedirs(dir_path)
+
+ with open(path, 'w') as junit_fd:
+ junit_fd.write(xml.lstrip())
+
+ sys.stderr.write(message + '\n')
+ sys.stderr.write(output + '\n')
+
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/cloud.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/cloud.sh
new file mode 100755
index 00000000..d76c3228
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/cloud.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+cloud="${args[0]}"
+python="${args[1]}"
+group="${args[2]}"
+
+target="shippable/${cloud}/group${group}/"
+
+stage="${S:-prod}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote-terminate always --remote-stage "${stage}" \
+ --docker --python "${python}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/freebsd.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/freebsd.sh
new file mode 100755
index 00000000..cd3014cc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/freebsd.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/linux.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/linux.sh
new file mode 100755
index 00000000..9cc2f966
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/linux.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+image="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --docker "${image}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/osx.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/osx.sh
new file mode 100755
index 00000000..cd3014cc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/osx.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/remote.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/remote.sh
new file mode 100755
index 00000000..cd3014cc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/remote.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/rhel.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/rhel.sh
new file mode 100755
index 00000000..cd3014cc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/rhel.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+platform="${args[0]}"
+version="${args[1]}"
+
+if [ "${#args[@]}" -gt 2 ]; then
+ target="shippable/posix/group${args[2]}/"
+else
+ target="shippable/posix/"
+fi
+
+stage="${S:-prod}"
+provider="${P:-default}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/sanity.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/sanity.sh
new file mode 100755
index 00000000..0c54a42c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/sanity.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+# shellcheck disable=SC2086
+ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
+ --docker \
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/shippable.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/shippable.sh
new file mode 100755
index 00000000..3cc948d5
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/shippable.sh
@@ -0,0 +1,133 @@
+#!/usr/bin/env bash
+
+### Environment variables
+
+ANSIBLE_VERSION="devel"
+PYTHON_VERSION="3.7"
+
+###
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+script="${args[0]}"
+
+test="$1"
+
+docker images ansible/ansible
+docker images quay.io/ansible/*
+docker ps
+
+for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v '^drydock/' | sed 's/^.* //'); do
+ docker rm -f "${container}" || true # ignore errors
+done
+
+docker ps
+
+if [ -d /home/shippable/cache/ ]; then
+ ls -la /home/shippable/cache/
+fi
+
+command -v python
+python -V
+
+command -v pip
+pip --version
+pip list --disable-pip-version-check
+
+export PATH="${PWD}/bin:${PATH}"
+export PYTHONIOENCODING='utf-8'
+
+if [ "${JOB_TRIGGERED_BY_NAME:-}" == "nightly-trigger" ]; then
+ COVERAGE=yes
+ COMPLETE=yes
+fi
+
+if [ -n "${COVERAGE:-}" ]; then
+ # on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value
+ export COVERAGE="--coverage"
+elif [[ "${COMMIT_MESSAGE}" =~ ci_coverage ]]; then
+ # on-demand coverage reporting triggered by having 'ci_coverage' in the latest commit message
+ export COVERAGE="--coverage"
+else
+ # on-demand coverage reporting disabled (default behavior, always-on coverage reporting remains enabled)
+ export COVERAGE="--coverage-check"
+fi
+
+if [ -n "${COMPLETE:-}" ]; then
+ # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
+ export CHANGED=""
+elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then
+ # disable change detection triggered by having 'ci_complete' in the latest commit message
+ export CHANGED=""
+else
+ # enable change detection (default behavior)
+ export CHANGED="--changed"
+fi
+
+if [ "${IS_PULL_REQUEST:-}" == "true" ]; then
+ # run unstable tests which are targeted by focused changes on PRs
+ export UNSTABLE="--allow-unstable-changed"
+else
+ # do not run unstable tests outside PRs
+ export UNSTABLE=""
+fi
+
+virtualenv --python /usr/bin/python${PYTHON_VERSION} ~/ansible-venv
+set +ux
+. ~/ansible-venv/bin/activate
+set -ux
+
+# Install Ansible
+pip install https://github.com/ansible/ansible/archive/${ANSIBLE_VERSION}.tar.gz --disable-pip-version-check
+
+COLLECTION_DIR="${HOME}/.ansible/ansible_collections/"
+TEST_DIR="${COLLECTION_DIR}/community/rabbitmq"
+mkdir -p "${TEST_DIR}"
+cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
+cd "${TEST_DIR}"
+
+function cleanup
+{
+ if [ -d tests/output/coverage/ ]; then
+ if find tests/output/coverage/ -mindepth 1 -name '.*' -prune -o -print -quit | grep -q .; then
+ # for complete on-demand coverage generate a report for all files with no coverage on the "other" job so we only have one copy
+ if [ "${COVERAGE}" == "--coverage" ] && [ "${CHANGED}" == "" ] && [ "${test}" == "sanity/1" ]; then
+ stub="--stub"
+ else
+ stub=""
+ fi
+
+ # shellcheck disable=SC2086
+ ansible-test coverage xml --color -v --requirements --group-by command --group-by version ${stub:+"$stub"}
+ cp -a tests/output/reports/coverage=*.xml shippable/codecoverage/
+ fi
+ fi
+
+ if [ -d tests/output/junit/ ]; then
+ cp -aT tests/output/junit/ shippable/testresults/
+ fi
+
+ if [ -d tests/output/data/ ]; then
+ cp -a tests/output/data/ shippable/testresults/
+ fi
+
+ if [ -d tests/output/bot/ ]; then
+ cp -aT tests/output/bot/ shippable/testresults/
+ fi
+}
+
+trap cleanup EXIT
+
+if [[ "${COVERAGE:-}" == "--coverage" ]]; then
+ timeout=60
+else
+ timeout=45
+fi
+
+ansible-test env --dump --show --timeout "${timeout}" --color -v
+
+"tests/utils/shippable/check_matrix.py"
+"tests/utils/shippable/${script}.sh" "${test}"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.py b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.py
new file mode 100755
index 00000000..fb538271
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3.7
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import sys
+import time
+
+start = time.time()
+
+sys.stdin.reconfigure(errors='surrogateescape')
+sys.stdout.reconfigure(errors='surrogateescape')
+
+for line in sys.stdin:
+ seconds = time.time() - start
+ sys.stdout.write('%02d:%02d %s' % (seconds // 60, seconds % 60, line))
+ sys.stdout.flush()
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.sh
new file mode 100755
index 00000000..77e25783
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/timing.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eu
+
+"$@" 2>&1 | "$(dirname "$0")/timing.py"
diff --git a/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/units.sh b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/units.sh
new file mode 100755
index 00000000..e2ff963f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/units.sh
@@ -0,0 +1,110 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+version="${args[1]}"
+group="${args[2]}"
+
+if [[ "${COVERAGE:-}" == "--coverage" ]]; then
+ timeout=90
+else
+ timeout=30
+fi
+
+group1=()
+group2=()
+group3=()
+
+# create three groups by putting network tests into separate groups
+# add or remove network platforms as needed to balance the groups
+
+networks2=(
+ aireos
+ apconos
+ aruba
+ asa
+ avi
+ check_point
+ cloudengine
+ cloudvision
+ cnos
+ cumulus
+ dellos10
+ dellos6
+ dellos9
+ edgeos
+ edgeswitch
+ enos
+ eos
+ eric_eccli
+ exos
+ f5
+ fortimanager
+ frr
+ ftd
+ icx
+ ingate
+ ios
+ iosxr
+ ironware
+ itential
+ junos
+ netact
+ netscaler
+ netvisor
+ nos
+ nso
+ nuage
+ nxos
+ onyx
+ opx
+ ovs
+ radware
+ routeros
+ slxos
+ voss
+ vyos
+)
+
+networks3=(
+ fortios
+)
+
+for network in "${networks2[@]}"; do
+ test_path="test/units/modules/network/${network}/"
+
+ if [ -d "${test_path}" ]; then
+ group1+=(--exclude "${test_path}")
+ group2+=("${test_path}")
+ fi
+done
+
+for network in "${networks3[@]}"; do
+ test_path="test/units/modules/network/${network}/"
+
+ if [ -d "${test_path}" ]; then
+ group1+=(--exclude "${test_path}")
+ group3+=("${test_path}")
+ fi
+done
+
+case "${group}" in
+ 1) options=("${group1[@]:+${group1[@]}}") ;;
+ 2) options=("${group2[@]:+${group2[@]}}") ;;
+ 3) options=("${group3[@]:+${group3[@]}}") ;;
+esac
+
+if [ ${#options[@]} -eq 0 ] && [ "${group}" -gt 1 ]; then
+ # allow collection migration unit tests for groups other than 1 to "pass" without updating shippable.yml or this script during migration
+ echo "No unit tests found for group ${group}."
+ exit
+fi
+
+ansible-test env --timeout "${timeout}" --color -v
+
+# shellcheck disable=SC2086
+ansible-test units --color -v --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
+ "${options[@]:+${options[@]}}" \