From 7bb0b12693dfd5897472c0adfd3ce8625262a93b Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 4 Sep 2019 12:10:56 -0400 Subject: [PATCH] Clean up basic integration tests and add a job for them These are basic tests but they need to be tested to make sure they keep working. Change-Id: I57bd3931655ca70a07b703b204933a70692f1671 --- .zuul.d/base-jobs.yaml | 9 +++++++++ .zuul.d/project.yaml | 2 ++ tests/basic.yaml | 27 +++++++++++++++------------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.zuul.d/base-jobs.yaml b/.zuul.d/base-jobs.yaml index 05015457..cc3d9d29 100644 --- a/.zuul.d/base-jobs.yaml +++ b/.zuul.d/base-jobs.yaml @@ -12,6 +12,15 @@ vars: tox_envlist: linters +# Equivalent to tox -e ansible-integration +- job: + name: ara-basic-ansible-integration + parent: base + nodeset: fedora-latest + run: tests/basic.yaml + vars: + ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara" + - secret: name: ara_git_mirror_credentials data: diff --git a/.zuul.d/project.yaml b/.zuul.d/project.yaml index 01b392ad..320c9942 100644 --- a/.zuul.d/project.yaml +++ b/.zuul.d/project.yaml @@ -14,6 +14,7 @@ - ansible-role-ara-api-fedora-distributed-sqlite - ansible-role-ara-web-ubuntu - ansible-role-ara-web-fedora + - ara-basic-ansible-integration - ara-tox-linters - ara-tox-py3 gate: @@ -27,6 +28,7 @@ - ansible-role-ara-api-fedora-distributed-sqlite - ansible-role-ara-web-ubuntu - ansible-role-ara-web-fedora + - ara-basic-ansible-integration - ara-tox-linters - ara-tox-py3 post: diff --git a/tests/basic.yaml b/tests/basic.yaml index 9e9e32e1..5f40cbcc 100644 --- a/tests/basic.yaml +++ b/tests/basic.yaml @@ -19,9 +19,10 @@ - name: Basic ARA tests without Ansible roles hosts: all vars: - _ansible_name: ansible - _ansible_version: latest + ara_tests_ansible_name: ansible + ara_tests_ansible_version: latest ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests" + ara_api_venv_path: "{{ ara_api_root_dir }}/virtualenv" ara_api_secret_key: testing ara_api_debug: true ara_api_log_level: DEBUG @@ -31,10 +32,10 @@ path: "{{ ara_api_root_dir }}" state: directory - - name: Set location of the git repository without Zuul + - name: Set source to checked out repository if it isn't specified set_fact: - _ara_tests_repository: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}" - when: zuul is not defined + ara_api_source: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}" + when: ara_api_source is not defined or ara_api_source is none - name: Ensure python3-venv is installed for Ubuntu become: yes @@ -45,22 +46,22 @@ # If a version is not explicitly set we want to make sure to # completely omit the version argument to pip, as it will be coming - # from the long-form integration_ansible_name variable. Additionally, if + # from the long-form ara_tests_ansible_name variable. Additionally, if # the version is the special value "latest", then we also want to omit # any version number, but also set the package state to "latest". - name: Set Ansible version for installation set_fact: - _install_ansible_version: "{{ _ansible_version }}" - when: _ansible_version not in ("", "latest") + _install_ansible_version: "{{ ara_tests_ansible_version }}" + when: ara_tests_ansible_version not in ("", "latest") - name: Set Ansible package state for installation set_fact: _install_ansible_state: latest - when: _ansible_version == "latest" + when: ara_tests_ansible_version == "latest" - name: Initialize virtual environment with Ansible pip: - name: "{{ _ansible_name }}" + name: "{{ ara_tests_ansible_name }}" version: "{{ _install_ansible_version | default(omit, True) }}" state: "{{ _install_ansible_state | default(omit, True) }}" virtualenv: "{{ ara_api_venv_path }}" @@ -68,7 +69,7 @@ - name: Install ARA from source in virtual environment pip: - name: "{{ _ara_tests_repository }}[server]" + name: "{{ ara_api_source }}[server]" state: present virtualenv: "{{ ara_api_venv_path }}" virtualenv_command: /usr/bin/python3 -m venv @@ -87,9 +88,11 @@ ARA_LOG_LEVEL: "{{ ara_api_log_level }}" ARA_BASE_DIR: "{{ ara_api_root_dir }}" ARA_SECRET_KEY: "{{ ara_api_secret_key }}" + ARA_API_CLIENT: "{{ ara_api_client | default('offline') }}" + ARA_API_SERVER: "{{ ara_api_server | default('http://127.0.0.1:8000') }}" vars: _ansible_playbook: "{{ ara_api_venv_path }}/bin/ansible-playbook -vvv" - _test_root: "{{ _ara_tests_repository }}/tests/integration" + _test_root: "{{ ara_api_source }}/tests/integration" block: # smoke.yaml tests setting ara_playbook_name in one of three plays - name: Run smoke.yaml integration test