ansible-role-qdrouterd/tests/test-qdrouterd-functional.yml
Andy Smith 5490543352 Create sasl user in func test
Change-Id: I8f0941bd847f26e0ba5ec925606ee30396be9230
2018-12-13 15:47:05 -05:00

124 lines
4.2 KiB
YAML

---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Run functional tests
hosts: qdrouterd_all
any_errors_fatal: true
user: root
gather_facts: true
become: true
tasks:
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ playbook_dir }}/../vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/../vars/{{ ansible_os_family | lower }}.yml"
- name: Check qdrouterd is running
command: "pgrep -f qdrouterd"
delegate_to: "{{ item }}"
when: ansible_host == item
with_items:
- 10.1.0.2
- 10.1.0.3
- 10.1.0.4
- name: Open qdrouterd.conf
slurp:
src: "{{ _qdrouterd_etc_conf_file }}"
register: qdrouterd_config
- name: Read qdrouterd_ssl_cert
stat:
path: "{{ qdrouterd_ssl_cert }}"
register: qdrouterd_ssl_cert_stat
- name: Read qdrouterd_ssl_key
stat:
path: "{{ qdrouterd_ssl_key }}"
register: qdrouterd_ssl_key_stat
- name: Read qdrouterd files
set_fact:
qdrouterd_config_contents: "{{ qdrouterd_config.content | b64decode }}"
qdrouterd_ssl_cert_checksum: "{{ qdrouterd_ssl_cert_stat.stat.checksum }}"
qdrouterd_ssl_key_checksum: "{{ qdrouterd_ssl_key_stat.stat.checksum }}"
- name: Check files contents
assert:
that:
- "'workerThreads' in qdrouterd_config_contents"
- name: Get general statistics of qdrouterd plain
command: "qdstat -g -b 0.0.0.0:31460"
register: qdrouterd_statistics_plain
changed_when: false
- name: Print qdrouterd_statistics plain
debug:
var: qdrouterd_statistics_plain
- name: Get qdrouterd node view using plain
command: "qdstat -nv -b 0.0.0.0:31460"
register: qdrouterd_nv_plain
changed_when: false
- name: Print qdrouterd_nv using plain
debug:
var: qdrouterd_nv_plain
- name: Get general statistics of qdrouterd using ssl
command: "qdstat -g -b 0.0.0.0:31459"
register: qdrouterd_statistics_ssl
changed_when: false
- name: Print qdrouterd_statistics using ssl
debug:
var: qdrouterd_statistics_ssl
- name: Get qdrouterd node view using ssl
command: "qdstat -nv -b 0.0.0.0:31459"
register: qdrouterd_nv_ssl
changed_when: false
- name: Print qdrouterd_nv using ssl
debug:
var: qdrouterd_nv_ssl
- name: Ensure SSL cert/key checksums are identical across the mesh
assert:
that:
- hostvars['container1']['qdrouterd_ssl_cert_checksum'] == hostvars['container2']['qdrouterd_ssl_cert_checksum'] == hostvars['container3']['qdrouterd_ssl_cert_checksum']
- hostvars['container1']['qdrouterd_ssl_key_checksum'] == hostvars['container2']['qdrouterd_ssl_key_checksum'] == hostvars['container3']['qdrouterd_ssl_key_checksum']
- name: Create a sasl user
shell: "echo secret | saslpasswd2 -c -p -f /var/lib/qdrouterd/qdrouterd.sasldb -u QPID myguest"
args:
creates: /var/lib/qdrouterd/qdrouterd.sasldb
- name: Get sasl user list
command: "sasldblistusers2 -f /var/lib/qdrouterd/qdrouterd.sasldb"
register: sasl_list
changed_when: false
- name: Check for user in sasl list
assert:
that:
- "'myguest@QPID:' in sasl_list.stdout"