Refactor basic integration jobs for Ansible versions

The latest supported version of Ansible (currently 2.9) is used in
integration test jobs unless specified otherwise.

The basic integration test jobs ensure that we have coverage for all
currently supported versions of Ansible as well as devel to let us know
if there are any upcoming breaking changes.

Change-Id: I1745f0cf22f802aba5bf7f3d120a6b03ac88a1dd
This commit is contained in:
David Moreau Simard 2020-01-27 16:42:05 -05:00
parent 3ff30f99ae
commit 9ff1f9f0c4
No known key found for this signature in database
GPG Key ID: 938880DAFC753E80
5 changed files with 78 additions and 111 deletions

View File

@ -1,8 +0,0 @@
# 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"

View File

@ -95,3 +95,38 @@
Deploys the ARA API server on Fedora 30 using distribution packages for
ARA and Ansible.
run: tests/with_fedora_packages.yaml
- job:
name: ara-ansible-integration-base
parent: ara-integration-base
nodeset: ara-fedora-30
vars:
ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara"
run: tests/basic.yaml
- job:
name: ara-basic-ansible-devel
parent: ara-ansible-integration-base
description: |
Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible devel.
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- job:
name: ara-basic-ansible-2.8
parent: ara-ansible-integration-base
description: |
Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible 2.8.
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.8
- job:
name: ara-basic-ansible-2.7
parent: ara-ansible-integration-base
description: |
Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible 2.7.
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.7

View File

@ -10,13 +10,12 @@
- ara-api-postgresql
- ara-api-fedora-packages:
voting: false
- ansible-role-ara-api-fedora-devel
- ansible-role-ara-api-fedora-2.9
- ansible-role-ara-api-ubuntu-2.8
- ansible-role-ara-api-ubuntu-2.7
- ara-basic-ansible-devel:
voting: false
- ara-basic-ansible-2.8
- ara-basic-ansible-2.7
- ansible-role-ara-web-ubuntu
- ansible-role-ara-web-fedora
- ara-basic-ansible-integration
- ara-tox-linters
- ara-tox-py3
gate:
@ -24,13 +23,10 @@
- ara-api-distributed-sqlite
- ara-api-mysql
- ara-api-postgresql
- ansible-role-ara-api-fedora-devel
- ansible-role-ara-api-fedora-2.9
- ansible-role-ara-api-ubuntu-2.8
- ansible-role-ara-api-ubuntu-2.7
- ara-basic-ansible-2.8
- ara-basic-ansible-2.7
- ansible-role-ara-web-ubuntu
- ansible-role-ara-web-fedora
- ara-basic-ansible-integration
- ara-tox-linters
- ara-tox-py3
post:

View File

@ -1,73 +1,3 @@
- job:
name: ansible-role-ara-api-base
parent: base
files:
- ara/*
- playbooks/*
- roles/*
- tests/*
- .zuul.d/*
- setup.py
- setup.cfg
- requirements.txt
- test-requirements.txt
pre-run: tests/role-integration-pre.yaml
post-run: tests/role-integration-post.yaml
vars:
ara_tests_cleanup: false
ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara"
ara_api_version: HEAD
ara_api_log_level: DEBUG
ara_api_debug: true
ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests"
ara_tests_ansible_name: "{{ ansible_user_dir }}/src/github.com/ansible/ansible"
ara_tests_ansible_version: null
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- job:
name: ansible-role-ara-api-ubuntu
parent: ansible-role-ara-api-base
nodeset: ubuntu-bionic
- job:
name: ansible-role-ara-api-fedora
parent: ansible-role-ara-api-base
nodeset: ara-fedora-30
- job:
name: ansible-role-ara-api-fedora-devel
parent: ansible-role-ara-api-fedora
run: tests/with_defaults.yaml
required-projects:
- name: github.com/ansible/ansible
override-checkout: devel
- job:
name: ansible-role-ara-api-fedora-2.9
parent: ansible-role-ara-api-fedora
run: tests/with_defaults.yaml
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- job:
name: ansible-role-ara-api-ubuntu-2.8
parent: ansible-role-ara-api-ubuntu
run: tests/with_defaults.yaml
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.8
- job:
name: ansible-role-ara-api-ubuntu-2.7
parent: ansible-role-ara-api-ubuntu
run: tests/with_defaults.yaml
required-projects:
- name: github.com/ansible/ansible
override-checkout: stable-2.7
# ara-web jobs
- job:
name: ansible-role-ara-web-base

View File

@ -19,30 +19,24 @@
- name: Basic ARA tests without Ansible roles
hosts: all
vars:
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
tasks:
- name: Ensure root directory exists
file:
path: "{{ ara_api_root_dir }}"
state: directory
- name: Set source to checked out repository if it isn't specified
# The name can be "ansible" when installing from pip or the path to an
# Ansible git repository on-disk.
# We're handling it here to allow various levels of variable precedence.
- name: Set default Ansible name if unset
set_fact:
ara_api_source: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}"
when: ara_api_source is not defined or ara_api_source is none
ara_tests_ansible_name: ansible
when: ara_tests_ansible_name is not defined or ara_tests_ansible_name is none
- name: Ensure python3-venv is installed for Ubuntu
become: yes
package:
name: python3-venv
state: present
when: ansible_distribution == "Ubuntu"
- name: Set default Ansible version is unset
set_fact:
ara_tests_ansible_version: latest
when: ara_tests_ansible_version is not defined or ara_tests_ansible_version is none
# 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
@ -59,6 +53,23 @@
_install_ansible_state: latest
when: ara_tests_ansible_version == "latest"
- name: Set source to checked out repository if it isn't specified
set_fact:
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 root directory exists
file:
path: "{{ ara_api_root_dir }}"
state: directory
- name: Ensure python3-venv is installed for Ubuntu
become: yes
package:
name: python3-venv
state: present
when: ansible_distribution == "Ubuntu"
- name: Initialize virtual environment with Ansible
pip:
name: "{{ ara_tests_ansible_name }}"
@ -86,35 +97,38 @@
ANSIBLE_ACTION_PLUGINS: "{{ ara_setup_plugins.stdout }}/action"
ARA_DEBUG: "{{ ara_api_debug }}"
ARA_LOG_LEVEL: "{{ ara_api_log_level }}"
ARA_BASE_DIR: "{{ ara_api_root_dir }}"
ARA_BASE_DIR: "{{ ara_api_root_dir }}/server"
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') }}"
PATH: "{{ ara_api_venv_path }}/bin:/bin:/usr/bin:/usr/local/bin"
vars:
_ansible_playbook: "{{ ara_api_venv_path }}/bin/ansible-playbook -vvv"
_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
command: "{{ _ansible_playbook }} {{ _test_root }}/smoke.yaml"
command: "ansible-playbook -vvv {{ _test_root }}/smoke.yaml"
- name: Run hosts.yaml integration test
command: "{{ _ansible_playbook }} {{ _test_root }}/hosts.yaml"
command: "ansible-playbook -vvv {{ _test_root }}/hosts.yaml"
- name: Run import.yaml integration test
command: "{{ _ansible_playbook }} {{ _test_root }}/import.yaml"
command: "ansible-playbook -vvv {{ _test_root }}/import.yaml"
# Tests setting ara_playbook_name as an extra var
- name: Run failed.yaml integration test
command: >
{{ _ansible_playbook }} {{ _test_root }}/failed.yaml -e ara_playbook_name="Failed playbook"
ansible-playbook -vvv {{ _test_root }}/failed.yaml -e ara_playbook_name="Failed playbook"
ignore_errors: yes
- name: Run incomplete.yaml integration test
shell: |
{{ _ansible_playbook }} {{ _test_root }}/incomplete.yaml &
ansible-playbook -vvv {{ _test_root }}/incomplete.yaml &
sleep 5
kill $!
args:
executable: /bin/bash
ignore_errors: yes
- name: Generate static report
command: ara-manage generate {{ ara_api_root_dir }}/static