[ci] add test hook for certificaiton task
- Move several common bash functions to separate file - Add test hook for rally certificaiton task Change-Id: Idbb2a255a2a57a9d14f8a9527a8a62a489c6c637
This commit is contained in:
parent
d4de18f329
commit
ca15159125
20
rally-jobs/certifcation_task_args.yaml
Normal file
20
rally-jobs/certifcation_task_args.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
service_list:
|
||||
- authentication
|
||||
- nova
|
||||
- neutron
|
||||
- keystone
|
||||
- cinder
|
||||
- glance
|
||||
use_existing_users: false
|
||||
image_name: "^(cirros.*uec|TestVM)$"
|
||||
flavor_name: "m1.tiny"
|
||||
glance_image_location: "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
|
||||
smoke: true
|
||||
users_amount: 1
|
||||
tenants_amount: 1
|
||||
controllers_amount: 1
|
||||
compute_amount: 1
|
||||
storage_amount: 1
|
||||
network_amount: 1
|
||||
|
13
tests/ci/hooks/certification_post_test_hook.sh
Executable file
13
tests/ci/hooks/certification_post_test_hook.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $SCRIPT_DIR/../rally_gate_functions.sh
|
||||
|
||||
setUp
|
||||
|
||||
TASK=$RALLY_DIR/certification/openstack/task.yaml
|
||||
TASK_ARGS=$RALLY_DIR/rally-jobs/certifcation_task_args.yaml
|
||||
|
||||
TASK_ARGS="--task-args-file $TASK_ARGS"
|
||||
|
||||
run $TASK $TASK_ARGS
|
@ -12,7 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# This script is executed by post_test_hook function in desvstack gate.
|
||||
# This script is executed by post_test_hook function in devstack gate.
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $SCRIPT_DIR/rally_gate_functions.sh
|
||||
|
||||
PROJECT=`echo $ZUUL_PROJECT | cut -d \/ -f 2`
|
||||
|
||||
@ -25,112 +28,14 @@ echo $RALLY_JOB_DIR
|
||||
echo $RALLY_DIR
|
||||
ls $BASE/new/$PROJECT
|
||||
|
||||
setUp $RALLY_JOB_DIR
|
||||
|
||||
BASE_FOR_TASK=${RALLY_JOB_DIR}/${RALLY_SCENARIO}
|
||||
|
||||
TASK=${BASE_FOR_TASK}.yaml
|
||||
TASK_ARGS=""
|
||||
if [ -f ${BASE_FOR_TASK}_args.yaml ]; then
|
||||
TASK_ARGS=" --task-args-file ${BASE_FOR_TASK}_args.yaml"
|
||||
TASK_ARGS="--task-args-file ${BASE_FOR_TASK}_args.yaml"
|
||||
fi
|
||||
|
||||
PLUGINS_DIR=${RALLY_JOB_DIR}/plugins
|
||||
EXTRA_DIR=${RALLY_JOB_DIR}/extra
|
||||
|
||||
RALLY_PLUGINS_DIR=~/.rally/plugins
|
||||
|
||||
mkdir -p $RALLY_PLUGINS_DIR
|
||||
if [ -d $PLUGINS_DIR ]; then
|
||||
cp -r $PLUGINS_DIR/ $RALLY_PLUGINS_DIR
|
||||
fi
|
||||
|
||||
if [ -d $EXTRA_DIR ]; then
|
||||
mkdir -p ~/.rally/extra
|
||||
cp -r $EXTRA_DIR/* ~/.rally/extra/
|
||||
touch ~/.rally/extra/fake-image.img
|
||||
fi
|
||||
|
||||
env
|
||||
set -o pipefail
|
||||
rally deployment use --deployment devstack
|
||||
|
||||
# NOTE(ikhudoshyn): Create additional users and register a new env
|
||||
# so that we could run scenarios using 'existing_users' context
|
||||
if [ "$DEVSTACK_GATE_PREPOPULATE_USERS" = "1" ]; then
|
||||
source ~/.rally/openrc admin admin
|
||||
openstack --version
|
||||
|
||||
openstack --os-interface admin project create rally-test-project-1
|
||||
openstack --os-interface admin user create --project rally-test-project-1 --password rally-test-password-1 rally-test-user-1
|
||||
|
||||
openstack --os-interface admin project create rally-test-project-2
|
||||
openstack --os-interface admin user create --project rally-test-project-2 --password rally-test-password-2 rally-test-user-2
|
||||
|
||||
set +e
|
||||
NEUTRON_EXISTS=$(openstack --os-interface admin service list | grep neutron)
|
||||
set -e
|
||||
if [ "$NEUTRON_EXISTS" ]; then
|
||||
OS_QUOTA_STR="--networks -1 --subnets -1 --routers -1 --floating-ips -1 --subnetpools -1 --secgroups -1 --secgroup-rules -1 --ports -1"
|
||||
openstack --os-interface admin quota set $OS_QUOTA_STR rally-test-project-1
|
||||
openstack --os-interface admin quota show rally-test-project-1
|
||||
openstack --os-interface admin quota set $OS_QUOTA_STR rally-test-project-2
|
||||
openstack --os-interface admin quota show rally-test-project-2
|
||||
fi
|
||||
|
||||
DEPLOYMENT_CONFIG_FILE=~/.rally/with-existing-users-config
|
||||
|
||||
rally deployment config > $DEPLOYMENT_CONFIG_FILE
|
||||
sed -i '1a "users": [\
|
||||
{\
|
||||
"username": "rally-test-user-1",\
|
||||
"password": "rally-test-password-1",\
|
||||
"tenant_name": "rally-test-project-1",\
|
||||
},\
|
||||
{\
|
||||
"username": "rally-test-user-2",\
|
||||
"password": "rally-test-password-2",\
|
||||
"tenant_name": "rally-test-project-2"\
|
||||
}\
|
||||
],\
|
||||
' $DEPLOYMENT_CONFIG_FILE
|
||||
|
||||
rally deployment create --name devstask-with-users --filename $DEPLOYMENT_CONFIG_FILE
|
||||
fi
|
||||
|
||||
rally deployment config
|
||||
rally --debug deployment check
|
||||
source ~/.rally/openrc demo demo
|
||||
if rally deployment check | grep 'nova' | grep 'Available' > /dev/null; then
|
||||
nova flavor-create m1.nano 42 64 0 1
|
||||
fi
|
||||
|
||||
python $BASE/new/rally/tests/ci/osresources.py\
|
||||
--dump-list resources_at_start.txt
|
||||
|
||||
rally -v --rally-debug task start --task $TASK $TASK_ARGS
|
||||
|
||||
mkdir -p rally-plot/extra
|
||||
python $BASE/new/rally/tests/ci/render.py ci/index.html > rally-plot/extra/index.html
|
||||
cp $TASK rally-plot/task.txt
|
||||
tar -czf rally-plot/plugins.tar.gz -C $RALLY_PLUGINS_DIR .
|
||||
rally task results | python -m json.tool > rally-plot/results.json
|
||||
gzip -9 rally-plot/results.json
|
||||
rally task detailed > rally-plot/detailed.txt
|
||||
gzip -9 rally-plot/detailed.txt
|
||||
rally task detailed --iterations-data > rally-plot/detailed_with_iterations.txt
|
||||
gzip -9 rally-plot/detailed_with_iterations.txt
|
||||
rally task report --out rally-plot/results.html
|
||||
gzip -9 rally-plot/results.html
|
||||
|
||||
# NOTE(stpierre): if the sla check fails, we still want osresources.py
|
||||
# to run, so we turn off -e and save the return value
|
||||
set +e
|
||||
rally task sla_check | tee rally-plot/sla.txt
|
||||
retval=$?
|
||||
set -e
|
||||
|
||||
cp resources_at_start.txt rally-plot/
|
||||
python $BASE/new/rally/tests/ci/osresources.py\
|
||||
--compare-with-list resources_at_start.txt\
|
||||
| gzip > rally-plot/resources_diff.txt.gz
|
||||
|
||||
exit $retval
|
||||
run $TASK $TASK_ARGS
|
||||
|
123
tests/ci/rally_gate_functions.sh
Normal file
123
tests/ci/rally_gate_functions.sh
Normal file
@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RALLY_DIR=$BASE/new/rally
|
||||
RALLY_PLUGINS_DIR=~/.rally/plugins
|
||||
RALLY_EXTRA_DIR=~/.rally/extra
|
||||
|
||||
function setUp () {
|
||||
set -x
|
||||
|
||||
JOB_DIR=$1
|
||||
|
||||
mkdir -p $RALLY_PLUGINS_DIR
|
||||
mkdir -p $RALLY_EXTRA_DIR
|
||||
|
||||
if [ -n "$JOB_DIR" ]; then
|
||||
PLUGINS_DIR=${JOB_DIR}/plugins
|
||||
EXTRA_DIR=${JOB_DIR}/extra
|
||||
|
||||
if [ -d $PLUGINS_DIR ]; then
|
||||
cp -r $PLUGINS_DIR/ $RALLY_PLUGINS_DIR
|
||||
fi
|
||||
|
||||
if [ -d $EXTRA_DIR ]; then
|
||||
cp -r $EXTRA_DIR/* ~/.rally/extra/
|
||||
fi
|
||||
fi
|
||||
|
||||
touch ~/.rally/extra/fake-image.img
|
||||
|
||||
env
|
||||
set -o pipefail
|
||||
|
||||
rally deployment use --deployment devstack
|
||||
|
||||
source ~/.rally/openrc admin admin
|
||||
|
||||
# NOTE(ikhudoshyn): Create additional users and register a new env
|
||||
# so that we could run scenarios using 'existing_users' context
|
||||
if [ "$DEVSTACK_GATE_PREPOPULATE_USERS" = "1" ]; then
|
||||
openstack --version
|
||||
|
||||
openstack --os-interface admin project create rally-test-project-1
|
||||
openstack --os-interface admin user create --project rally-test-project-1 --password rally-test-password-1 rally-test-user-1
|
||||
|
||||
openstack --os-interface admin project create rally-test-project-2
|
||||
openstack --os-interface admin user create --project rally-test-project-2 --password rally-test-password-2 rally-test-user-2
|
||||
|
||||
set +e
|
||||
NEUTRON_EXISTS=$(openstack --os-interface admin service list | grep neutron)
|
||||
set -e
|
||||
if [ "$NEUTRON_EXISTS" ]; then
|
||||
OS_QUOTA_STR="--networks -1 --subnets -1 --routers -1 --floating-ips -1 --subnetpools -1 --secgroups -1 --secgroup-rules -1 --ports -1"
|
||||
openstack --os-interface admin quota set $OS_QUOTA_STR rally-test-project-1
|
||||
openstack --os-interface admin quota show rally-test-project-1
|
||||
openstack --os-interface admin quota set $OS_QUOTA_STR rally-test-project-2
|
||||
openstack --os-interface admin quota show rally-test-project-2
|
||||
fi
|
||||
|
||||
DEPLOYMENT_CONFIG_FILE=~/.rally/with-existing-users-config
|
||||
|
||||
rally deployment config > $DEPLOYMENT_CONFIG_FILE
|
||||
sed -i '1a "users": [\
|
||||
{\
|
||||
"username": "rally-test-user-1",\
|
||||
"password": "rally-test-password-1",\
|
||||
"tenant_name": "rally-test-project-1",\
|
||||
},\
|
||||
{\
|
||||
"username": "rally-test-user-2",\
|
||||
"password": "rally-test-password-2",\
|
||||
"tenant_name": "rally-test-project-2"\
|
||||
}\
|
||||
],\
|
||||
' $DEPLOYMENT_CONFIG_FILE
|
||||
|
||||
rally deployment create --name devstask-with-users --filename $DEPLOYMENT_CONFIG_FILE
|
||||
fi
|
||||
|
||||
rally deployment config
|
||||
rally --debug deployment check
|
||||
|
||||
if rally deployment check | grep 'nova' | grep 'Available' > /dev/null;
|
||||
then
|
||||
nova flavor-create m1.nano 42 64 0 1
|
||||
fi
|
||||
}
|
||||
|
||||
function run () {
|
||||
set -x
|
||||
|
||||
TASK=$1
|
||||
TASK_ARGS="$2 $3"
|
||||
python $RALLY_DIR/tests/ci/osresources.py --dump-list resources_at_start.txt
|
||||
|
||||
rally --rally-debug task start --task $TASK $TASK_ARGS
|
||||
|
||||
mkdir -p rally-plot/extra
|
||||
python $RALLY_DIR/tests/ci/render.py ci/index.html > rally-plot/extra/index.html
|
||||
cp $TASK rally-plot/task.txt
|
||||
tar -czf rally-plot/plugins.tar.gz -C $RALLY_PLUGINS_DIR .
|
||||
rally task results | python -m json.tool > rally-plot/results.json
|
||||
gzip -9 rally-plot/results.json
|
||||
rally task detailed > rally-plot/detailed.txt
|
||||
gzip -9 rally-plot/detailed.txt
|
||||
rally task detailed --iterations-data > rally-plot/detailed_with_iterations.txt
|
||||
gzip -9 rally-plot/detailed_with_iterations.txt
|
||||
rally task report --out rally-plot/results.html
|
||||
gzip -9 rally-plot/results.html
|
||||
|
||||
# NOTE(stpierre): if the sla check fails, we still want osresources.py
|
||||
# to run, so we turn off -e and save the return value
|
||||
set +e
|
||||
rally task sla_check | tee rally-plot/sla.txt
|
||||
retval=$?
|
||||
set -e
|
||||
|
||||
cp resources_at_start.txt rally-plot/
|
||||
python $RALLY_DIR/tests/ci/osresources.py\
|
||||
--compare-with-list resources_at_start.txt\
|
||||
| gzip > rally-plot/resources_diff.txt.gz
|
||||
|
||||
exit $retval
|
||||
}
|
Loading…
Reference in New Issue
Block a user