From 767682b6f47fdb749efd114e04ad452c4a025df1 Mon Sep 17 00:00:00 2001 From: "Donovan Francesco (drifterza)" Date: Thu, 22 Sep 2016 20:32:09 +0200 Subject: [PATCH] Functional testing for the role gate Simple REST API based functional testing for trove will now be run during the gate. Change-Id: Ie8621ebc756a82cb47cef73172881848454dba7e Closes-Bug: #1624520 --- manual-test.rc | 2 +- tests/ansible-role-requirements.yml | 16 ++++++--- tests/test-install-trove.yml | 2 +- tests/test-trove-functional.yml | 51 +++++++++++++++++++++++++++++ tests/test-vars.yml | 5 ++- tests/test.yml | 3 ++ tox.ini | 3 -- 7 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 tests/test-trove-functional.yml diff --git a/manual-test.rc b/manual-test.rc index f7e7771..7016c45 100644 --- a/manual-test.rc +++ b/manual-test.rc @@ -30,4 +30,4 @@ export ANSIBLE_SSH_ARGS="-o ControlMaster=no \ -o ForwardAgent=yes" echo "Run manual functional tests by executing the following:" -echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\"" +echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml" diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index ba9188a..a82f343 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -22,6 +22,10 @@ src: https://git.openstack.org/openstack/openstack-ansible-lxc_container_create scm: git version: master +- name: memcached_server + src: https://git.openstack.org/openstack/openstack-ansible-memcached_server + scm: git + version: master - name: galera_client src: https://git.openstack.org/openstack/openstack-ansible-galera_client scm: git @@ -34,11 +38,15 @@ src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server scm: git version: master -- name: os_keystone - src: https://git.openstack.org/openstack/openstack-ansible-os_keystone - scm: git - version: master - name: openstack_openrc src: https://git.openstack.org/openstack/openstack-ansible-openstack_openrc scm: git version: master +- name: os_keystone + src: https://git.openstack.org/openstack/openstack-ansible-os_keystone + scm: git + version: master +- name: openstack_hosts + src: https://github.com/openstack/openstack-ansible-openstack_hosts + scm: git + version: master diff --git a/tests/test-install-trove.yml b/tests/test-install-trove.yml index c6c5d17..4c70ffe 100644 --- a/tests/test-install-trove.yml +++ b/tests/test-install-trove.yml @@ -76,7 +76,7 @@ when: inventory_hostname == groups['trove_all'][0] roles: - - role: "{{ rolename | basename }}" + - role: "os_trove" vars_files: - playbooks/test-vars.yml - test-vars.yml diff --git a/tests/test-trove-functional.yml b/tests/test-trove-functional.yml new file mode 100644 index 0000000..25bbcba --- /dev/null +++ b/tests/test-trove-functional.yml @@ -0,0 +1,51 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# 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. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# Reference: http://developer.openstack.org/api-ref-database-v1.html + +- name: Playbook for functional testing of trove + hosts: trove_all + user: root + gather_facts: false + vars: + trove_api: "http://localhost:{{ trove_service_port }}" + tasks: + - name: Install openstackclient + pip: + name: "python-openstackclient" + + - name: Check the trove-api + uri: + url: "{{ trove_api }}" + status_code: 200,300 + + - name: Validate that auth is required + uri: + url: "{{ trove_api }}/v1.0/status" + status_code: 401 + + - name: Get auth token + shell: > + . /root/openrc && openstack token issue --format yaml | awk '/^id\:/ {print $2}' + register: get_keystone_token + + - name: set token + set_fact: + keystone_token: "{{ get_keystone_token.stdout }}" + + vars_files: + - test-vars.yml diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 68e6520..b646eaa 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -34,11 +34,10 @@ trove_service_project_name: service trove_service_region: RegionOne trove_service_user_domain_id: default trove_service_user_name: trove +trove_service_port: 8779 +trove_venv_tag: untagged trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" -trove_venv_tag: "testing" - neutron_service_port: 9696 swift_proxy_port: 8080 cinder_service_port: 8776 nova_service_port: 8774 - diff --git a/tests/test.yml b/tests/test.yml index ad038a8..d64aa6b 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -27,3 +27,6 @@ # Install trove - include: test-install-trove.yml + +# Test trove +- include: test-trove-functional.yml diff --git a/tox.ini b/tox.ini index 37c7b20..8445991 100755 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,6 @@ passenv = NO_PROXY whitelist_externals = bash - echo git rm wget @@ -140,7 +139,6 @@ commands = ansible-playbook -i {toxinidir}/tests/inventory \ --syntax-check \ --list-tasks \ - -e "rolename={toxinidir}" \ {toxinidir}/tests/test.yml @@ -186,7 +184,6 @@ setenv = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ -e "install_test_packages=True" \ {toxinidir}/tests/test.yml -vvvv {[testenv:func_logs]commands}