From 3c0f6d5ced2474240fa14f5594b84c527767edca Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Mon, 28 Mar 2016 04:18:23 -0400 Subject: improvement: rubbos test suite running workflow JIRA: BOTTLENECK-46 1)add .py file for test suite running entrance and .yaml config files 2)adjust the project test running scripts to top directory Change-Id: Iad9eedf704e85a8c7e974310938a7d652d008469 Signed-off-by: MatthewLi --- ci/common.sh | 29 ---------- common.sh | 29 ++++++++++ run_tests.sh | 5 +- testsuites/rubbos/run_rubbos.py | 0 testsuites/rubbos/run_rubbos.sh | 70 ++++++++++++++++++++++++ testsuites/rubbos/testcase_cfg/rubbos_1-1-1.yaml | 24 ++++++++ testsuites/rubbos/testcase_cfg/rubbos_1-2-1.yaml | 24 ++++++++ 7 files changed, 150 insertions(+), 31 deletions(-) delete mode 100755 ci/common.sh create mode 100755 common.sh create mode 100755 testsuites/rubbos/run_rubbos.py diff --git a/ci/common.sh b/ci/common.sh deleted file mode 100755 index 16966320..00000000 --- a/ci/common.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -mkdir -p /home/opnfv/bottlenecks/config -config_file=/home/opnfv/bottlenecks/config/bottlenecks_cfg.yaml - -if [ ! -f ${config_file} ]; then - default_config_file=$(find /home/opnfv/repos -name bottlenecks_cfg.yaml) - cp $default_config_file $config_file - echo "bottlenecks_cfg.yaml not provided. Using default one" -fi - -SUITE_PREFIX_CONFIG=$(cat $config_file | grep -w suite_prefix_config | awk 'END {print $NF}') - -info () { - logger -s -t "bottlenecks.info" "$*" -} - -error () { - logger -s -t "bottlenecks.error" "$*" - exit 1 -} diff --git a/common.sh b/common.sh new file mode 100755 index 00000000..16966320 --- /dev/null +++ b/common.sh @@ -0,0 +1,29 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +mkdir -p /home/opnfv/bottlenecks/config +config_file=/home/opnfv/bottlenecks/config/bottlenecks_cfg.yaml + +if [ ! -f ${config_file} ]; then + default_config_file=$(find /home/opnfv/repos -name bottlenecks_cfg.yaml) + cp $default_config_file $config_file + echo "bottlenecks_cfg.yaml not provided. Using default one" +fi + +SUITE_PREFIX_CONFIG=$(cat $config_file | grep -w suite_prefix_config | awk 'END {print $NF}') + +info () { + logger -s -t "bottlenecks.info" "$*" +} + +error () { + logger -s -t "bottlenecks.error" "$*" + exit 1 +} diff --git a/run_tests.sh b/run_tests.sh index 9ae89b17..b87d2fcb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -67,7 +67,7 @@ function run_test(){ case $test_suite in "rubbos") info "Running rubbos test suite" - test_file="/home/opnfv/bottlenecks/testsuite/rubbos/testsuite_story/rubbos_story1" + test_file="/home/opnfv/bottlenecks/testsuites/rubbos/testsuite_story/rubbos_story1" if [[ -f $test_file ]]; then testcases=($(cat $test_file)) else @@ -78,7 +78,8 @@ function run_test(){ check_testcase -rubbos $i #adjust config parameters, different test suite has different methods, take rubbos as an example #run test case, different test suite has different methods - + file={$BASEDIR}/testsuites/rubbos/testcase_cfg/{$i}.yaml + python ${BOTTLENECK_TOP_DIR}/testsuites/rubbos/run_rubbos.py $file done ;; "vstf") diff --git a/testsuites/rubbos/run_rubbos.py b/testsuites/rubbos/run_rubbos.py new file mode 100755 index 00000000..e69de29b diff --git a/testsuites/rubbos/run_rubbos.sh b/testsuites/rubbos/run_rubbos.sh index e69de29b..b7492adc 100755 --- a/testsuites/rubbos/run_rubbos.sh +++ b/testsuites/rubbos/run_rubbos.sh @@ -0,0 +1,70 @@ +#!/bin/bash +############################################################################### +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +usage="Script to run the tests in rubbos. + +usage: + bash $(basename "$0") [-h|--help] [-s ] + +where: + -h|--help show the help text + -t|--test run specifif test case scenario + examples: + rubbos_1-1-1, rubbos_1-2-1 + +examples: + $(basename "$0") + $(basename "$0") -t rubbos_1-1-1" + +while [[ $# > 0 ]] + do + key="$1" + case $key in + -h|--help) + echo "$usage" + exit 0 + shift + ;; + -t|--test) + CASE="$2" + shift + ;; + *) + echo "unkown option $1 $2" + exit 1 + ;; + esac + shift +done + +BASEDIR=`dirname $0` + +#has been checked in upper layer run_tests.sh +#run tests +if [ "${CASE}" != "" ]; then + case_exec=(${CASE//,/}) + for case_exe in "${case_exec[@]}"; do + client_num=4 + tomcat_num=$(echo "$case_exe"| awk -F '-' '{print $2}') + mysql_num=$(echo "$case_exe"| awk -F '-' '{print $3') + + hosts=(rubbos_control rubbos_benchmark rubbos_httpd) + for((i=1; i <= client_num; i++)); do + hosts=(${hosts[*]} client$i) + done + for((i=1; i <= tomcat_num; i++)); do + hosts=(${hosts[*]} tomcat$i) + done + for((i=1; i <= mysql_num; i++)); do + hosts=(${hosts[*]} mysql$i) + done + bash $BOTTLENECKS_TOP_DIR/utils/infra_setup/heat_template/rubbos_heat_template/HOT_create_instance.sh + done +fi diff --git a/testsuites/rubbos/testcase_cfg/rubbos_1-1-1.yaml b/testsuites/rubbos/testcase_cfg/rubbos_1-1-1.yaml index e69de29b..cb590c0a 100755 --- a/testsuites/rubbos/testcase_cfg/rubbos_1-1-1.yaml +++ b/testsuites/rubbos/testcase_cfg/rubbos_1-1-1.yaml @@ -0,0 +1,24 @@ +--- + +description: + casename: "rubbos_1-1-1" + +amount: + client_num: 5 + httpd_num: 1 + tomcat_num: 1 + mysql_num: 1 + +vms: + client_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + httpd_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + tomcat_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + mysql_vm: + flavor: "m1.medium" + OS_image: "ubuntu14.04" diff --git a/testsuites/rubbos/testcase_cfg/rubbos_1-2-1.yaml b/testsuites/rubbos/testcase_cfg/rubbos_1-2-1.yaml index e69de29b..3a6e448f 100755 --- a/testsuites/rubbos/testcase_cfg/rubbos_1-2-1.yaml +++ b/testsuites/rubbos/testcase_cfg/rubbos_1-2-1.yaml @@ -0,0 +1,24 @@ +--- + +description: + casename: "rubbos_1-1-1" + +amount: + client_num: 5 + httpd_num: 1 + tomcat_num: 2 + mysql_num: 1 + +vms: + client_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + httpd_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + tomcat_vm: + flavor: "m1.tiny" + OS_image: "ubuntu14.04" + mysql_vm: + flavor: "m1.medium" + OS_image: "ubuntu14.04" -- cgit 1.2.3-korg