From 9413b830df7c23705fe45a24e81bb17a432de93d Mon Sep 17 00:00:00 2001 From: Sergey Lukjanov Date: Mon, 17 Aug 2015 00:50:27 +0300 Subject: [PATCH] Run scenario tests for the fake plugin in gate Generate template_vars.ini for the scenario testing framework and run it using existing templates for sahara-ci (tmp). Change-Id: Ibfd787247bf04b3c75d7341c3fecd6a5c5621e0d --- tools/gate/scenario/commons | 42 +++++++++++++++++++++ tools/gate/scenario/post_test_hook.sh | 54 +++++++++++++++++++++++++++ tools/gate/scenario/pre_test_hook.sh | 32 ++++++++++++++++ tools/gate/scenario/settings | 21 +++++++++++ 4 files changed, 149 insertions(+) create mode 100644 tools/gate/scenario/commons create mode 100644 tools/gate/scenario/settings diff --git a/tools/gate/scenario/commons b/tools/gate/scenario/commons new file mode 100644 index 00000000..30d4cb76 --- /dev/null +++ b/tools/gate/scenario/commons @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (c) 2015 Mirantis 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. + +export NETWORK=${1:-neutron} +export ENGINE=${2:-heat} + +# Normalize network name +if [[ $NETWORK == nova* ]]; then + export NETWORK="nova-network" +fi + +source settings + +export DEST=${DEST:-$BASE/new} +export DEVSTACK_DIR=${DEVSTACK_DIR:-$DEST/devstack} +export SAHARA_DIR=${SAHARA_DIR:-$DEST/sahara} + +export LOCALRC_PATH=$DEVSTACK_DIR/localrc +export LOCALCONF_PATH=$DEVSTACK_DIR/local.conf + +function sahara_register_fake_plugin_image { + local props="--property _sahara_tag_0.1=True" + props+=" --property _sahara_tag_fake=True" + props+=" --property _sahara_username=$SAHARA_FAKE_PLUGIN_IMAGE_USERNAME" + + openstack --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image set \ + $SAHARA_FAKE_PLUGIN_IMAGE_NAME $props +} diff --git a/tools/gate/scenario/post_test_hook.sh b/tools/gate/scenario/post_test_hook.sh index e69de29b..97c3ac1e 100755 --- a/tools/gate/scenario/post_test_hook.sh +++ b/tools/gate/scenario/post_test_hook.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Copyright (c) 2015 Mirantis 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. + +# This script is executed inside post_test_hook function in devstack gate. + +set -ex + +source commons $@ + +set +x +source $DEVSTACK_DIR/stackrc +source $DEVSTACK_DIR/openrc admin admin +set -x + +sahara_register_fake_plugin_image + +sudo -E chown -R jenkins:stack $SAHARA_DIR +cd $SAHARA_DIR + +echo "Generating scenario tests config file" +sudo -E -u jenkins tee template_vars.ini <> $LOCALRC_PATH + +# Here we can set some configurations for localrc +# echo "SAHARA_INFRA_ENGINE=heat" >> $LOCALRC_PATH + +# Here we can set some configurations for local.conf +# for example, to pass some config options directly to sahara.conf file +# echo -e '[[post-config|$SAHARA_CONF]]\n[DEFAULT]\n' >> $LOCALCONF_PATH +# echo -e 'infrastructure_engine=true\n' >> $LOCALCONF_PATH diff --git a/tools/gate/scenario/settings b/tools/gate/scenario/settings new file mode 100644 index 00000000..ec829464 --- /dev/null +++ b/tools/gate/scenario/settings @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright (c) 2015 Mirantis 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. + +#TODO(slukjanov): replace with special image for fake plugin (cloud ubuntu?) +export SAHARA_FAKE_PLUGIN_IMAGE=http://tarballs.openstack.org/heat-test-image/fedora-heat-test-image.qcow2 +export SAHARA_FAKE_PLUGIN_IMAGE_NAME=$(basename $SAHARA_FAKE_PLUGIN_IMAGE .qcow2) +export SAHARA_FAKE_PLUGIN_IMAGE_USERNAME=fedora