rally-openstack/tests/ci/rally_self_job.sh
Anton Studenov 4c146445ac [Core] Add support for default platform and rally self job
* Added default credentials for all deployments.
* Added Dummy.openstack scenario that allows running
  openstack contexts with dummy scenario.
* Removed openstack users context from samples and jobs
  where it was not required.

Co-Authored-By: Anton Studenov <astudenov@mirantis.com>
Change-Id: I851f2c71e4db25bef17e25c143275e75b16595bf
2017-03-27 20:04:14 +03:00

48 lines
1.6 KiB
Bash
Executable File

#!/bin/bash -ex
#
# 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.
TASK_FILE=$1
PLUGIN_PATHS=rally-jobs/plugins
if [ -n "$ZUUL_PROJECT" ]; then
HTML_REPORT=testr_results.html
else
HTML_REPORT=rally_self_results.html
fi
RND=$(head /dev/urandom | tr -dc a-z0-9 | head -c 5)
TMP_RALLY_CONF="/tmp/self-rally-$RND.conf"
TMP_RALLY_DB="/tmp/self-rally-$RND.sqlite"
TMP_RALLY_DEPLOYMENT="/tmp/self-rally-dep-$RND.json"
DBCONNSTRING="sqlite:///$TMP_RALLY_DB"
RALLY="rally --config-file $TMP_RALLY_CONF"
# Create temp db
cp etc/rally/rally.conf.sample $TMP_RALLY_CONF
sed -i.bak "s|#connection =.*|connection = \"$DBCONNSTRING\"|" $TMP_RALLY_CONF
rally-manage --config-file $TMP_RALLY_CONF db create
# Create self deployment
echo '{"type": "ExistingCloud", "creds": {}}' > $TMP_RALLY_DEPLOYMENT
$RALLY -d deployment create --file=$TMP_RALLY_DEPLOYMENT --name=self
# Run task
$RALLY -d --plugin-paths=$PLUGIN_PATHS task start $TASK_FILE
$RALLY task report --html-static --out $HTML_REPORT
if [ -n "$ZUUL_PROJECT" ]; then
gzip -9 -f $HTML_REPORT
fi
# Check sla (this may fail the job)
$RALLY task sla-check