ansible-role-qdrouterd/tests/test-qdrouterd-functional.yml
Jean-Philippe Evrard 1269d327cd Introduce base Zuul jobs
Now that the zuul base jobs from infra have been merged, we
can test the role as an independant entity.

The first step is to get it pass lint tests, so all the
other jobs as marked as non-voting.

Change-Id: I00d6c066fea8ec70ae032010199d00f089005065
Co-Authored-By: Andrew Smith <ansmith@redhat.com>
2018-06-25 13:27:33 +00:00

91 lines
3.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
command: "qdstat -g -b 0.0.0.0:31459"
register: qdrouterd_statistics
changed_when: false
- name: Print qdrouterd_statistics
debug:
var: qdrouterd_statistics
- name: Get qdrouterd node view
command: "qdstat -nv -b 0.0.0.0:31459"
register: qdrouterd_nv
changed_when: false
- name: Print qdrouterd_nv
debug:
var: qdrouterd_nv
- 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']