summaryrefslogtreecommitdiffstats
path: root/ci/daily.sh
blob: bdfe7468d7c1bdc1e780fa029d49cbfac78d1935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash -x
##############################################################################
# Copyright (c) 2015 EMC 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
##############################################################################

if [ -z $WORKSPACE ]
then
    cd `dirname $0`/..
    WORKSPACE=`pwd`
fi

# This is set by Jenkins, but if we are running manually, just use the
# current hostname.
if [ -z "$NODE_NAME" ]
then
    NODE_NAME=`hostname`
fi
export POD_NAME=$NODE_NAME

if [ -d $WORKSPACE/ci/job ]
then
    sudo rm -rf $WORKSPACE/ci/job
fi
sudo find $WORKSPACE/ -name '*.db' -exec rm -fv {} \;

$WORKSPACE/ci/generate-admin-rc.sh
$WORKSPACE/ci/generate-environment.sh

. $WORKSPACE/ci/job/environment.rc
for env in `cat $WORKSPACE/ci/job/admin.rc`
do
    export $env
done

echo "Checking for an existing stack"
STACK_ID=`heat stack-list | grep StorPerfAgentGroup | awk '{print $2}'`
if [ ! -z $STACK_ID ]
then
    heat stack-delete -y StorPerfAgentGroup
fi

while [ ! -z $STACK_ID ]
do
    STACK_ID=`heat stack-list | grep StorPerfAgentGroup | awk '{print $2}'`
done

echo "TEST_DB_URL=http://testresults.opnfv.org/test/api/v1" >> $WORKSPACE/ci/job/admin.rc
echo "INSTALLER_TYPE=${INSTALLER}" >> $WORKSPACE/ci/job/admin.rc
$WORKSPACE/ci/launch_docker_container.sh

echo "Waiting for StorPerf to become active"
while [ $(curl -X GET 'http://127.0.0.1:5000/api/v1.0/configurations' > /dev/null 2>&1;echo $?) -ne 0 ]
do
    sleep 1
done

echo Creating 1:1 stack
$WORKSPACE/ci/create_stack.sh $CINDER_NODES 10

export QUEUE_DEPTH=8
export BLOCK_SIZE=16384
export WORKLOAD=ws
export SCENARIO_NAME="${CINDER_BACKEND}_${WORKLOAD}"
WARM_UP=`$WORKSPACE/ci/start_job.sh | awk '/job_id/ {print $2}' | sed 's/"//g'`

WARM_UP_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$WARM_UP&type=status" \
    | awk '/Status/ {print $2}' | sed 's/"//g'`
while [ "$WARM_UP_STATUS" != "Completed" ]
do
    sleep 10
    WARM_UP_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$WARM_UP&type=status" \
    | awk '/Status/ {print $2}' | sed 's/"//g'`
done


for WORKLOAD in ws wr rs rr rw
do
    for BLOCK_SIZE in 2048 8192 16384
    do
        for QUEUE_DEPTH in 1 2 8
        do
            export QUEUE_DEPTH
            export BLOCK_SIZE
            export WORKLOAD
            export SCENARIO_NAME="${CINDER_BACKEND}_${WORKLOAD}"

            JOB=`$WORKSPACE/ci/start_job.sh \
                | awk '/job_id/ {print $2}' | sed 's/"//g'`
            JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
                | awk '/Status/ {print $2}' | sed 's/"//g'`
            while [ "$JOB_STATUS" != "Completed" ]
            do
                sleep 10
                JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
                    | awk '/Status/ {print $2}' | sed 's/"//g'`
            done
        done
    done
done


echo "Deleting stack for cleanup"
curl -X DELETE --header 'Accept: application/json' 'http://127.0.0.1:5000/api/v1.0/configurations'

exit 0