From b9babfe3f495fed09c5f6f5c23ab820c35ea51d0 Mon Sep 17 00:00:00 2001 From: "Donovan Francesco (drifterza)" Date: Thu, 17 Nov 2016 10:43:04 +0200 Subject: [PATCH] Using updated tempest method for trove api. Change-Id: I3e8498db924ef095078e56bbedb8fbd587f4986c --- .gitignore | 7 +-- defaults/main.yml | 5 +- tests/ansible-role-requirements.yml | 4 ++ tests/inventory | 3 + .../{test-vars.yml => os_trove-overrides.yml} | 12 +++- tests/test-install-trove.yml | 62 +++---------------- tests/test-trove-functional.yml | 51 --------------- tests/test.yml | 4 +- 8 files changed, 32 insertions(+), 116 deletions(-) rename tests/{test-vars.yml => os_trove-overrides.yml} (87%) delete mode 100644 tests/test-trove-functional.yml diff --git a/.gitignore b/.gitignore index 21adf3c..b57b99d 100755 --- a/.gitignore +++ b/.gitignore @@ -61,11 +61,8 @@ ChangeLog releasenotes/build # Test temp files -tests/plugins -tests/playbooks -tests/test.retry +tests/common +tests/*.retry # Vagrant artifacts .vagrant - - diff --git a/defaults/main.yml b/defaults/main.yml index 4f200b6..840fc34 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -72,6 +72,7 @@ trove_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/trove.tgz trove_git_repo: "https://git.openstack.org/openstack/trove" trove_git_install_branch: master + trove_developer_mode: false trove_developer_constraints: - "git+{{ trove_git_repo }}@{{ trove_git_install_branch }}#egg=trove" @@ -133,8 +134,6 @@ trove_requires_pip_packages: - httplib2 - python-glanceclient - python-keystoneclient - - python-memcached - - python-troveclient - virtualenv - virtualenv-tools @@ -144,6 +143,8 @@ trove_pip_packages: - pexpect - pycrypto - trove + - python-troveclient + - python-memcached # This variable is used by the repo_build process to determine # which host group to check for members of before building the diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 95008e0..95ec41b 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -46,3 +46,7 @@ src: https://git.openstack.org/openstack/openstack-ansible-os_keystone scm: git version: master +- name: os_tempest + src: https://git.openstack.org/openstack/openstack-ansible-os_tempest + scm: git + version: master diff --git a/tests/inventory b/tests/inventory index 5d08c2b..bdae959 100644 --- a/tests/inventory +++ b/tests/inventory @@ -16,6 +16,9 @@ infra1 [memcached_all] infra1 +[utility_all] +openstack1 + [service_all:children] rabbitmq_all galera_all diff --git a/tests/test-vars.yml b/tests/os_trove-overrides.yml similarity index 87% rename from tests/test-vars.yml rename to tests/os_trove-overrides.yml index 518f527..833712a 100644 --- a/tests/test-vars.yml +++ b/tests/os_trove-overrides.yml @@ -37,9 +37,19 @@ trove_service_region: RegionOne trove_service_user_domain_id: default trove_service_user_name: trove trove_service_port: 8779 -trove_venv_tag: untagged +trove_venv_tag: "untagged" trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" neutron_service_port: 9696 swift_proxy_port: 8080 cinder_service_port: 8776 nova_service_port: 8774 + +tempest_run: yes + +tempest_plugins: + - name: trove + repo: https://git.openstack.org/openstack/trove + branch: master + +tempest_test_whitelist: + - trove.tests.tempest.tests.api.database.versions.* diff --git a/tests/test-install-trove.yml b/tests/test-install-trove.yml index 5a884ec..8328408 100644 --- a/tests/test-install-trove.yml +++ b/tests/test-install-trove.yml @@ -21,62 +21,14 @@ user: root gather_facts: true pre_tasks: - # NOTE: These are typically installed in the repo server where we build the - # trove wheel - - name: Install packages required to build trove python package - apt: - name: "{{ item }}" - with_items: - - libxml2-dev - - libxslt-dev - - libffi-dev - - pkg-config - - libvirt-dev - when: inventory_hostname in groups['trove_all'] - - name: Ensure rabbitmq vhost - rabbitmq_vhost: - name: "{{ trove_rabbitmq_vhost }}" - state: "present" - delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['trove_all'][0] - - name: Ensure rabbitmq user - rabbitmq_user: - user: "{{ trove_rabbitmq_userid }}" - password: "{{ trove_rabbitmq_password }}" - vhost: "{{ trove_rabbitmq_vhost }}" - configure_priv: ".*" - read_priv: ".*" - write_priv: ".*" - state: "present" - delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['trove_all'][0] - - name: Create DB for service - mysql_db: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ trove_galera_address }}" - name: "{{ trove_galera_database_name }}" - state: "present" - delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['trove_all'][0] - - name: Grant access to the DB for the service - mysql_user: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ trove_galera_address }}" - name: "{{ trove_galera_database_name }}" - password: "{{ trove_galera_password }}" - host: "{{ item }}" - state: "present" - priv: "{{ trove_galera_database_name }}.*:ALL" - with_items: - - "localhost" - - "%" - delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['trove_all'][0] - + - include: common/create-grant-db.yml + db_name: "{{ trove_galera_database_name }}" + db_password: "{{ trove_galera_password }}" + - include: common/ensure-rabbitmq.yml + vhost_name: "{{ trove_rabbitmq_vhost }}" + user_name: "{{ trove_rabbitmq_userid }}" + user_password: "{{ trove_rabbitmq_password }}" roles: - role: "os_trove" vars_files: - common/test-vars.yml - - test-vars.yml diff --git a/tests/test-trove-functional.yml b/tests/test-trove-functional.yml deleted file mode 100644 index 25bbcba..0000000 --- a/tests/test-trove-functional.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -# 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.yml b/tests/test.yml index d075595..1946724 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -28,5 +28,5 @@ # Install trove - include: test-install-trove.yml -# Test trove -- include: test-trove-functional.yml +# Install and execute Tempest +- include: common/test-install-tempest.yml