Replace the ansible-integration job by the new integration jobs
ara-infra now provides a new and improved set of integration jobs so we no longer need to have the ansible-integration job. These new jobs test ara-server, ara-clients and ara-plugins against a variety of operating systems and versions of Ansible. It was convenient to be able to run these tests from ara-server by itself, we'll re-introduce a wrapper so we can continue to do so later. Depends-On: https://review.openstack.org/#/c/630303 Change-Id: Iedf259e44af5165be08c5d6917e5af98b281202d
This commit is contained in:
parent
ca0137b437
commit
3d5efff28c
|
@ -1,10 +1,3 @@
|
|||
- job:
|
||||
name: ara-server-ansible-integration
|
||||
parent: tox
|
||||
nodeset: ubuntu-bionic
|
||||
vars:
|
||||
tox_envlist: ansible-integration
|
||||
|
||||
- job:
|
||||
name: ara-tox-py3
|
||||
parent: tox
|
||||
|
|
|
@ -5,11 +5,15 @@
|
|||
- docs-on-readthedocs
|
||||
check:
|
||||
jobs:
|
||||
- ara-server-ansible-integration:
|
||||
- ara-integration-fedora-2.7
|
||||
- ara-integration-fedora-devel:
|
||||
voting: false
|
||||
- ara-integration-ubuntu-2.6
|
||||
- ara-tox-linters
|
||||
- ara-tox-py3
|
||||
gate:
|
||||
jobs:
|
||||
- ara-integration-fedora-2.7
|
||||
- ara-integration-ubuntu-2.6
|
||||
- ara-tox-linters
|
||||
- ara-tox-py3
|
||||
|
|
|
@ -87,10 +87,6 @@ Development
|
|||
# Install tox from pip or from your distro packages
|
||||
pip install tox
|
||||
|
||||
# Run an Ansible playbook integrated with ara-server, ara-clients and ara-plugins
|
||||
# This will exercise all three components and record real data from Ansible
|
||||
tox -e ansible-integration
|
||||
|
||||
# Run test server -> http://127.0.0.1:8000/api/v1/
|
||||
tox -e runserver
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
filename: /tmp/ara-hacking
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Create a file
|
||||
template:
|
||||
src: hacking.j2
|
||||
dest: "{{ filename }}"
|
|
@ -1,42 +0,0 @@
|
|||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
galaxy_info:
|
||||
author: OpenStack community
|
||||
description: Hacking
|
||||
company: Red Hat
|
||||
license: GPL v3
|
||||
min_ansible_version: 2.5
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- installer
|
||||
- application
|
||||
- system
|
||||
dependencies: []
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: echo something
|
||||
command: echo something
|
||||
register: echo
|
||||
|
||||
- name: debug something
|
||||
debug:
|
||||
var: echo
|
||||
|
||||
- name: Ensure a file is absent
|
||||
file:
|
||||
path: "{{ filename }}"
|
||||
state: absent
|
||||
notify:
|
||||
- create a file
|
|
@ -1 +0,0 @@
|
|||
Hello world
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: A test play
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Include a role
|
||||
include_role:
|
||||
name: hacking
|
||||
|
||||
- name: Another test play
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
pre_tasks:
|
||||
- name: Pre task
|
||||
debug:
|
||||
msg: Task from a pre-task
|
||||
tasks:
|
||||
- name: Task
|
||||
debug:
|
||||
msg: Task from a task
|
||||
post_tasks:
|
||||
- name: Post Task
|
||||
debug:
|
||||
msg: Task from a post-task
|
|
@ -1,118 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# A very basic script to smoke test that the Ansible integration is not
|
||||
# horribly broken until we get something more robust in place.
|
||||
|
||||
from ara.clients.offline import AraOfflineClient
|
||||
|
||||
|
||||
def validate_playbook(playbook):
|
||||
assert len(playbook['arguments']) == 40
|
||||
assert len(playbook['files']) == 5
|
||||
assert playbook['status'] == 'completed'
|
||||
|
||||
|
||||
def validate_play(play):
|
||||
assert play['status'] == "completed"
|
||||
|
||||
|
||||
def validate_task(task):
|
||||
assert task['status'] == "completed"
|
||||
|
||||
|
||||
def validate_host(host):
|
||||
assert 'facts' in host
|
||||
assert 'ansible_user_id' in host['facts']
|
||||
|
||||
|
||||
def validate_result(result):
|
||||
assert 'content' in result
|
||||
assert 'ansible_facts' in result['content']
|
||||
assert 'status' in result
|
||||
assert result['status'] == 'ok'
|
||||
|
||||
|
||||
def validate_stats(stats):
|
||||
assert 'failed' in stats
|
||||
assert stats['failed'] == 0
|
||||
assert 'playbook' in stats
|
||||
assert 'host' in stats
|
||||
|
||||
|
||||
def main():
|
||||
client = AraOfflineClient()
|
||||
|
||||
playbooks = client.get('/api/v1/playbooks')
|
||||
assert len(playbooks['results']) == 1
|
||||
assert playbooks['count'] == 1
|
||||
validate_playbook(playbooks['results'][0])
|
||||
|
||||
playbook = client.get(
|
||||
'/api/v1/playbooks/%s' % playbooks['results'][0]['id']
|
||||
)
|
||||
validate_playbook(playbook)
|
||||
|
||||
plays = client.get('/api/v1/plays')
|
||||
assert len(plays['results']) == 2
|
||||
assert plays['count'] == 2
|
||||
validate_play(plays['results'][0])
|
||||
|
||||
play = client.get(
|
||||
'/api/v1/plays/%s' % plays['results'][0]['id']
|
||||
)
|
||||
validate_play(play)
|
||||
|
||||
tasks = client.get('/api/v1/tasks')
|
||||
assert len(tasks['results']) == 8
|
||||
assert tasks['count'] == 8
|
||||
validate_task(tasks['results'][0])
|
||||
|
||||
task = client.get(
|
||||
'/api/v1/tasks/%s' % tasks['results'][0]['id']
|
||||
)
|
||||
validate_task(task)
|
||||
|
||||
hosts = client.get('/api/v1/hosts')
|
||||
assert len(hosts['results']) == 1
|
||||
assert hosts['count'] == 1
|
||||
validate_host(hosts['results'][0])
|
||||
|
||||
host = client.get(
|
||||
'/api/v1/hosts/%s' % hosts['results'][0]['id']
|
||||
)
|
||||
validate_host(host)
|
||||
|
||||
results = client.get('/api/v1/results')
|
||||
assert len(results['results']) == 8
|
||||
assert results['count'] == 8
|
||||
validate_result(results['results'][0])
|
||||
|
||||
result = client.get('/api/v1/results/1')
|
||||
validate_result(result)
|
||||
|
||||
stats = client.get('/api/v1/stats')
|
||||
assert len(stats['results']) == 1
|
||||
assert stats['count'] == 1
|
||||
validate_stats(stats['results'][0])
|
||||
|
||||
client.log.info('All assertions passed.')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
21
tox.ini
21
tox.ini
|
@ -25,7 +25,7 @@ commands = ara-manage test ara
|
|||
setenv =
|
||||
ARA_DEBUG=true
|
||||
ARA_LOG_LEVEL=DEBUG
|
||||
ARA_BASE_DIR={toxinidir}/.tox/ansible-integration/tmp/ara
|
||||
ARA_BASE_DIR={toxinidir}/.tox/py3/tmp/ara
|
||||
|
||||
[testenv:runserver]
|
||||
commands =
|
||||
|
@ -35,24 +35,7 @@ commands =
|
|||
setenv =
|
||||
ARA_DEBUG=true
|
||||
ARA_LOG_LEVEL=DEBUG
|
||||
ARA_BASE_DIR={toxinidir}/.tox/ansible-integration/tmp/ara
|
||||
|
||||
# Temporary venv to help bootstrap integration
|
||||
[testenv:ansible-integration]
|
||||
deps =
|
||||
git+https://git.openstack.org/openstack/ara-plugins@master#egg=ara_plugins
|
||||
git+https://git.openstack.org/openstack/ara-clients@master#egg=ara_clients
|
||||
commands =
|
||||
rm -rf {toxinidir}/.tox/ansible-integration/tmp/ara
|
||||
bash -c 'ANSIBLE_CALLBACK_PLUGINS=$(python -c "import os,ara.plugins; print(os.path.dirname(ara.plugins.__file__))")/callback ansible-playbook {toxinidir}/hacking/test-playbook.yml'
|
||||
python {toxinidir}/hacking/validate.py
|
||||
setenv =
|
||||
ARA_DEBUG=true
|
||||
ARA_LOG_LEVEL=DEBUG
|
||||
ARA_BASE_DIR={toxinidir}/.tox/ansible-integration/tmp/ara
|
||||
whitelist_externals =
|
||||
rm
|
||||
bash
|
||||
ARA_BASE_DIR={toxinidir}/.tox/runserver/tmp/ara
|
||||
|
||||
[testenv:cover]
|
||||
commands =
|
||||
|
|
Loading…
Reference in New Issue