mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove residual rabbitmq integration test targets (#59)
In [a] These should have been removed, but they weren't. [a] https://github.com/ansible-collections/community.general/pull/13
This commit is contained in:
parent
c874089d1d
commit
67bea39474
7 changed files with 0 additions and 221 deletions
|
@ -1,7 +0,0 @@
|
||||||
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
|
|
|
@ -1,2 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- setup_rabbitmq
|
|
|
@ -1,5 +0,0 @@
|
||||||
# Rabbitmq lookup
|
|
||||||
- include: ubuntu.yml
|
|
||||||
when:
|
|
||||||
- ansible_distribution == 'Ubuntu'
|
|
||||||
- ansible_distribution_release != 'trusty'
|
|
|
@ -1,138 +0,0 @@
|
||||||
- name: Test failure without pika installed
|
|
||||||
set_fact:
|
|
||||||
rabbit_missing_pika: "{{ lookup('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('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('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('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('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('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('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
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- setup_tls
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: ubuntu.yml
|
|
||||||
when: ansible_distribution == 'Ubuntu'
|
|
|
@ -1,63 +0,0 @@
|
||||||
---
|
|
||||||
# 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
|
|
Loading…
Reference in a new issue