From 75fd7d7f80e77f2113aa5a4b9fa3608ac3ffaded Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 5 Oct 2016 12:12:34 +0100 Subject: [PATCH] Use centralised Ansible test scripts This patch consumes the centralised Ansible test scripts implemented in https://review.openstack.org/381853 Combined backport of: - https://review.openstack.org/382290 - https://review.openstack.org/388424 Change-Id: I486582d6793f61a08e09da8fe04203fac9c214bd (cherry picked from commit 82d81c9b024e77348363c93cc7588af4e168c792) --- tests/host_vars/localhost.yml | 18 ++++++++++++++ tests/inventory | 5 ++++ tests/test.yml | 2 ++ tox.ini | 45 ++++++----------------------------- 4 files changed, 32 insertions(+), 38 deletions(-) create mode 100644 tests/host_vars/localhost.yml diff --git a/tests/host_vars/localhost.yml b/tests/host_vars/localhost.yml new file mode 100644 index 0000000..b66509b --- /dev/null +++ b/tests/host_vars/localhost.yml @@ -0,0 +1,18 @@ +--- +# Copyright 2016, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ansible_become: True +ansible_host: 127.0.0.1 +ansible_python_interpreter: "/usr/bin/python2" diff --git a/tests/inventory b/tests/inventory index 6c0833a..9e53f4a 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,2 +1,7 @@ [all] localhost ansible_connection=local ansible_become=True + +[all_containers] + +[memcached_all] +localhost diff --git a/tests/test.yml b/tests/test.yml index 98a65ae..2a419c0 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -41,3 +41,5 @@ - "'-c 1024' in memcached_proc.stdout" - "'-t 4' in memcached_proc.stdout" - "'STAT pid' in memcached_stats.stdout" + vars_files: + - common/test-vars.yml diff --git a/tox.ini b/tox.ini index 1c6df2c..027ca26 100644 --- a/tox.ini +++ b/tox.ini @@ -25,6 +25,7 @@ whitelist_externals = setenv = PYTHONUNBUFFERED=1 ROLE_NAME=memcached_server + TEST_IDEMPOTENCE=false VIRTUAL_ENV={envdir} WORKING_DIR={toxinidir} @@ -83,62 +84,30 @@ commands = deps = {[testenv]deps} -rhttp://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt?h=stable/newton -commands = - {[testenv:tests_clone]commands} - bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh" [testenv:ansible-syntax] deps = {[testenv:ansible]deps} commands = - {[testenv:ansible]commands} - ansible-playbook -i {toxinidir}/tests/inventory \ - --syntax-check \ - --list-tasks \ - {toxinidir}/tests/test.yml + {[testenv:tests_clone]commands} + bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh" [testenv:ansible-lint] deps = {[testenv:ansible]deps} commands = - {[testenv:ansible]commands} - ansible-lint {toxinidir} - - -[testenv:func_base] -# NOTE(odyssey4me): this target does not use constraints because -# it doesn't work in OpenStack-CI yet. Once that's fixed, we can -# drop the install_command. -install_command = - pip install -U --force-reinstall {opts} {packages} - - -[testenv:func_logs] -commands = - bash -c "{toxinidir}/tests/common/test-log-collect.sh" + {[testenv:tests_clone]commands} + bash -c "{toxinidir}/tests/common/test-ansible-lint.sh" [testenv:functional] -# Ignore_errors is set to true so that the logs are collected at the -# end of the run. This will not produce a false positive. Any -# exception will be mark the run as failed and exit 1 after all of -# the commands have been iterated through. -ignore_errors = True -# NOTE(odyssey4me): this target does not use constraints because -# it doesn't work in OpenStack-CI yet. Once that's fixed, we can -# drop the install_command. -install_command = - {[testenv:func_base]install_command} deps = {[testenv:ansible]deps} commands = - {[testenv:ansible]commands} - ansible-playbook -i {toxinidir}/tests/inventory \ - -e "install_test_packages=True" \ - {toxinidir}/tests/test.yml -vvvv - {[testenv:func_logs]commands} + {[testenv:tests_clone]commands} + bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" [testenv:linters]