ara-collection/tests/with_distributed_sqlite.yaml
David Moreau Simard ec0f681252
CI: Import role integration jobs from ara repository
This imports the role integration test playbooks and Zuul CI jobs from
the main ara repository.

The distributed-sqlite job is meant to be voting but there is a
regression that needs to be addressed first [1].

[1]: https://github.com/ansible-community/ara/issues/149

Change-Id: I19af271b6740c953cb29872e2474fb6d5a7a03d2
2020-07-23 22:09:36 -04:00

56 lines
1.7 KiB
YAML

---
# Copyright (c) 2020 The ARA Records Ansible authors
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- name: Test the ARA API with the distributed sqlite backend
hosts: all
gather_facts: yes
vars_files:
- vars/distributed_sqlite_tests.yaml
tasks:
# Generate ourselves a fresh database to run tests with
- name: Set up the API with the default sqlite backend
include_role:
name: ara_api
public: yes
# These are tasks rather than a standalone playbook to give us an easy
# access to all the variables within the same play.
- include_tasks: test_tasks.yaml
- name: Enable the distributed sqlite backend
vars:
ara_api_distributed_sqlite: true
include_role:
name: ara_api
public: yes
- name: Ensure there are no pending handlers
meta: flush_handlers
- name: Create test directories
file:
path: "{{ ara_api_distributed_sqlite_root }}/{{ item }}"
state: directory
recurse: yes
loop: "{{ _test_directories }}"
- name: Copy the database to the test directories
copy:
src: "{{ ara_api_database_name }}"
dest: "{{ ara_api_distributed_sqlite_root }}/{{ item }}/ansible.sqlite"
remote_src: true
loop: "{{ _test_directories }}"
- name: Test that the API works
uri:
url: "http://127.0.0.1:8000/{{ item }}/api/v1/"
return_content: yes
register: api_test
loop: "{{ _test_directories }}"
- name: Print API responses for debug purposes
debug:
msg: "{{ item['json'] | to_nice_json }}"
loop: "{{ api_test.results }}"