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
This commit is contained in:
Sergey Lukjanov 2015-08-17 00:50:27 +03:00
parent 8db1109cc6
commit 9413b830df
4 changed files with 149 additions and 0 deletions

View File

@ -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
}

View File

@ -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 <<EOF
[DEFAULT]
OS_USERNAME: ${OS_USERNAME}
OS_PASSWORD: ${OS_PASSWORD}
OS_TENANT_NAME: ${OS_TENANT_NAME}
OS_AUTH_URL: ${OS_AUTH_URL}
network_type: ${NETWORK}
network_private_name: ${PRIVATE_NETWORK_NAME}
network_public_name: ${PUBLIC_NETWORK_NAME}
fake_plugin_image: ${SAHARA_FAKE_PLUGIN_IMAGE_NAME}
ci_flavor_id: '2'
cluster_name: fake-cluster
EOF
echo "Running scenario tests"
# TODO(slukjanov): Create separated list of templates for fake plugin in gate
sudo -u jenkins tox -e scenario -- --verbose -V template_vars.ini \
etc/scenario/gate/credentials.yaml.mako \
etc/scenario/gate/edp.yaml.mako \
etc/scenario/gate/fake.yaml.mako

View File

@ -0,0 +1,32 @@
#!/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 pre_test_hook function in devstack gate.
set -ex
source commons $@
echo "IMAGE_URLS=$SAHARA_FAKE_PLUGIN_IMAGE" >> $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

View File

@ -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