From 3d5efff28c490583b4647fa1cd7585f6490c8e54 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 23 Jan 2019 09:51:30 -0500 Subject: [PATCH] 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 --- .zuul.d/jobs.yaml | 7 -- .zuul.d/project.yaml | 6 +- README.rst | 4 - hacking/roles/hacking/defaults/main.yml | 19 ---- hacking/roles/hacking/handlers/main.yml | 22 ---- hacking/roles/hacking/meta/main.yml | 42 -------- hacking/roles/hacking/tasks/main.yml | 32 ------ hacking/roles/hacking/templates/hacking.j2 | 1 - hacking/test-playbook.yml | 40 ------- hacking/validate.py | 118 --------------------- tox.ini | 21 +--- 11 files changed, 7 insertions(+), 305 deletions(-) delete mode 100644 hacking/roles/hacking/defaults/main.yml delete mode 100644 hacking/roles/hacking/handlers/main.yml delete mode 100644 hacking/roles/hacking/meta/main.yml delete mode 100644 hacking/roles/hacking/tasks/main.yml delete mode 100644 hacking/roles/hacking/templates/hacking.j2 delete mode 100644 hacking/test-playbook.yml delete mode 100644 hacking/validate.py diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index 55f896f..f40a6eb 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -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 diff --git a/.zuul.d/project.yaml b/.zuul.d/project.yaml index eba6be2..6b220e6 100644 --- a/.zuul.d/project.yaml +++ b/.zuul.d/project.yaml @@ -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 diff --git a/README.rst b/README.rst index 5acddcf..82fe7b6 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/hacking/roles/hacking/defaults/main.yml b/hacking/roles/hacking/defaults/main.yml deleted file mode 100644 index 5f4601c..0000000 --- a/hacking/roles/hacking/defaults/main.yml +++ /dev/null @@ -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 . - -filename: /tmp/ara-hacking \ No newline at end of file diff --git a/hacking/roles/hacking/handlers/main.yml b/hacking/roles/hacking/handlers/main.yml deleted file mode 100644 index 99628bc..0000000 --- a/hacking/roles/hacking/handlers/main.yml +++ /dev/null @@ -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 . - -- name: Create a file - template: - src: hacking.j2 - dest: "{{ filename }}" diff --git a/hacking/roles/hacking/meta/main.yml b/hacking/roles/hacking/meta/main.yml deleted file mode 100644 index 391f042..0000000 --- a/hacking/roles/hacking/meta/main.yml +++ /dev/null @@ -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 . - -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: [] diff --git a/hacking/roles/hacking/tasks/main.yml b/hacking/roles/hacking/tasks/main.yml deleted file mode 100644 index e162a94..0000000 --- a/hacking/roles/hacking/tasks/main.yml +++ /dev/null @@ -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 . - -- 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 diff --git a/hacking/roles/hacking/templates/hacking.j2 b/hacking/roles/hacking/templates/hacking.j2 deleted file mode 100644 index 70c379b..0000000 --- a/hacking/roles/hacking/templates/hacking.j2 +++ /dev/null @@ -1 +0,0 @@ -Hello world \ No newline at end of file diff --git a/hacking/test-playbook.yml b/hacking/test-playbook.yml deleted file mode 100644 index da008ed..0000000 --- a/hacking/test-playbook.yml +++ /dev/null @@ -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 . - -- 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 diff --git a/hacking/validate.py b/hacking/validate.py deleted file mode 100644 index 6765114..0000000 --- a/hacking/validate.py +++ /dev/null @@ -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 . - -# 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() diff --git a/tox.ini b/tox.ini index edaa54c..4f4617a 100644 --- a/tox.ini +++ b/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 =