From fc2fe868079d42b320e2535cad92f13b36212b9b Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Thu, 7 Apr 2016 11:03:20 +0100 Subject: [PATCH] Add Tempest Plugin to DevStack Plugin Additionally, execute the tests in the gate Change-Id: I58930c40243068e97ff8f6f1684cfbe5565ac7f1 Depends-On: I7733e8786d6b525a7c9a8d4f12add329cd030d9d Depends-On: Ic1ee7f8bfea7954fca4057b74b76fcb502bb782d Partially-Implements: blueprint designate-tempest-plugin --- contrib/vagrant/Vagrantfile | 8 +++++++ contrib/vagrant/local.conf | 4 ++-- devstack/gate/post_test_hook.sh | 4 ++++ devstack/gate/run_tempest_plugin.sh | 33 +++++++++++++++++++++++++++++ devstack/plugin.sh | 11 ++++++++++ devstack/settings | 4 ++++ 6 files changed, 62 insertions(+), 2 deletions(-) create mode 100755 devstack/gate/run_tempest_plugin.sh diff --git a/contrib/vagrant/Vagrantfile b/contrib/vagrant/Vagrantfile index 46d95f76b..964acc0e8 100644 --- a/contrib/vagrant/Vagrantfile +++ b/contrib/vagrant/Vagrantfile @@ -26,6 +26,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.synced_folder "../../../designate-dashboard", "/opt/stack/designate-dashboard" end + if File.directory?("../../../designate-tempest-plugin") + override.vm.synced_folder "../../../designate-tempest-plugin", "/opt/stack/designate-tempest-plugin" + end + if File.directory?("../../../../openstack/rally") override.vm.synced_folder "../../../../openstack/rally", "/opt/stack/rally" end @@ -50,6 +54,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.synced_folder "../../../designate-dashboard", "/opt/stack/designate-dashboard", type: "nfs" end + if File.directory?("../../../designate-tempest-plugin") + override.vm.synced_folder "../../../designate-tempest-plugin", "/opt/stack/designate-tempest-plugin", type: "nfs" + end + if File.directory?("../../../../openstack/rally") override.vm.synced_folder "../../../../openstack/rally", "/opt/stack/rally", type: "nfs" end diff --git a/contrib/vagrant/local.conf b/contrib/vagrant/local.conf index 3b77a8830..778a13486 100644 --- a/contrib/vagrant/local.conf +++ b/contrib/vagrant/local.conf @@ -106,8 +106,8 @@ enable_service designate,designate-central,designate-api,designate-pool-manager, # Optional TLS Proxy #enable_service tls-proxy -# Optional Tempest -#enable_service tempest +# Optional Tempest (Recommended) +enable_service tempest # Optional Rally #enable_service rally diff --git a/devstack/gate/post_test_hook.sh b/devstack/gate/post_test_hook.sh index 41dd63147..7197cf4a9 100755 --- a/devstack/gate/post_test_hook.sh +++ b/devstack/gate/post_test_hook.sh @@ -8,6 +8,10 @@ $BASE/new/designate/devstack/exercise.sh # Import functions needed for the below workaround source $BASE/new/devstack/functions +# Run the new style tempest plugin first, so the workaround below is not +# applied. +sudo BASE=$BASE ./run_tempest_plugin.sh + # Workaround for Tempest architectural changes # See bugs: # 1) https://bugs.launchpad.net/manila/+bug/1531049 diff --git a/devstack/gate/run_tempest_plugin.sh b/devstack/gate/run_tempest_plugin.sh new file mode 100755 index 000000000..7a5dba195 --- /dev/null +++ b/devstack/gate/run_tempest_plugin.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e +# +# 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. + +# TODO(kiall): One old style tests are no longer used, we should switch from +# this pattern for executing the tests to a true tempest gate job. + +# How many seconds to wait for the API to be responding before giving up +API_RESPONDING_TIMEOUT=20 + +if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:9001/ 2>/dev/null | grep -q 'v1' ; do sleep 1; done"; then + echo "The Designate API failed to respond within ${API_RESPONDING_TIMEOUT} seconds" + exit 1 +fi + +echo "Successfully contacted the Designate API" + +# Where Tempest code lives +TEMPEST_DIR=${TEMPEST_DIR:-"$BASE/new/tempest"} + +pushd $TEMPEST_DIR +tox -e all-plugin -- designate +popd diff --git a/devstack/plugin.sh b/devstack/plugin.sh index b886032df..41c458e9b 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -262,6 +262,12 @@ function install_designatedashboard { ln -fs $DESIGNATEDASHBOARD_DIR/designatedashboard/enabled/_1720_project_dns_panel.py $HORIZON_DIR/openstack_dashboard/local/enabled/_1720_project_dns_panel.py } +# install_designatetempest - Collect source and prepare +function install_designatetempest { + git_clone_by_name "designate-tempest-plugin" + setup_dev_lib "designate-tempest-plugin" +} + # start_designate - Start running processes, including screen function start_designate { start_designate_backend @@ -313,6 +319,11 @@ if is_service_enabled designate; then install_designatedashboard fi + if is_service_enabled tempest; then + echo_summary "Installing Designate Tempest Plugin" + install_designatetempest + fi + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring Designate" configure_designate diff --git a/devstack/settings b/devstack/settings index 5dd16eb22..30d2d9a62 100644 --- a/devstack/settings +++ b/devstack/settings @@ -42,6 +42,10 @@ DESIGNATEDASHBOARD_REPO=${DESIGNATEDASHBOARD_REPO:-${GIT_BASE}/openstack/designa DESIGNATEDASHBOARD_BRANCH=${DESIGNATEDASHBOARD_BRANCH:-master} GITDIR["python-designateclient"]=$DEST/python-designateclient +GITREPO["designate-tempest-plugin"]=${DESIGNATETEMPEST_REPO:-${GIT_BASE}/openstack/designate-tempest-plugin.git} +GITBRANCH["designate-tempest-plugin"]=${DESIGNATETEMPEST_BRANCH:-master} +GITDIR["designate-tempest-plugin"]=$DEST/designate-tempest-plugin + # Tell Tempest this project is present TEMPEST_SERVICES+=,designate