This patch contains scripts to update the measurement name as
[kvmfornfv.git] / ci / envs / cyclictest.sh
1 #!/bin/bash
2
3 ###########################################################
4 ## Invoking this script from ubuntu docker container runs
5 ## cyclictest through yardstick
6 ###########################################################
7 source utils.sh
8
9 testType=$1 #daily/verify/merge
10 HOST_IP=$( getHostIP )
11 pod_config='/opt/scripts/pod.yaml'
12 cyclictest_context_file='/opt/kvmfornfv_cyclictest_idle_idle.yaml'
13
14 if [ ! -f ${pod_config} ] ; then
15     echo "file ${pod_config} not found"
16     exit 1
17 fi
18
19 if [ ! -f ${cyclictest_context_file} ] ; then
20     echo "file ${cyclictest_context_file} not found"
21     exit 1
22 fi
23
24 #setting up of image for launching guest vm.
25 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
26 root@$HOST_IP "cp /root/images/guest1.qcow2 /root/"
27
28 #Updating the yardstick.conf file for daily
29 function updateConfDaily() {
30    DISPATCHER_TYPE=influxdb
31    DISPATCHER_FILE_NAME="/tmp/yardstick.out"
32    # Use the influxDB on the jumping server
33    DISPATCHER_INFLUXDB_TARGET="http://10.2.117.21:8086"
34    mkdir -p /etc/yardstick
35    cat << EOF > /etc/yardstick/yardstick.conf
36 [DEFAULT]
37 debug = True
38 dispatcher = ${DISPATCHER_TYPE}
39
40 [dispatcher_file]
41 file_name = ${DISPATCHER_FILE_NAME}
42
43 [dispatcher_influxdb]
44 timeout = 5
45 db_name = yardstick
46 username = root
47 password = root
48 target = ${DISPATCHER_INFLUXDB_TARGET}
49 EOF
50 }
51
52 #Function call to update yardstick conf file based on Job type
53 if [ "$testType" == "daily" ];then
54    updateConfDaily
55 fi
56
57 #Running cyclictest through yardstick
58 yardstick -d task start ${cyclictest_context_file}
59 output=$?
60
61 if [ "$testType" == "verify" ];then
62    chmod 777 /tmp/yardstick.out
63    cat /tmp/yardstick.out  > /opt/yardstick.out
64 fi
65
66 if [ $output != 0 ];then
67    echo "Yardstick Failed !!!"
68    exit 1
69 fi