-
Notifications
You must be signed in to change notification settings - Fork 2
/
runtest.sh
executable file
·133 lines (110 loc) · 2.98 KB
/
runtest.sh
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"
export SCRIPT_LOCATION='/Users/hugo/Documents/workspace/cs-functional-test'
export DEVCLOUD=192.168.56.9
export DEVCLOUD_VBOX=7abb7a53-7b1c-4b2e-98e9-2cc4a3775039
export HYPERVISOR=192.168.56.11
export HYPERVISOR_VBOX=62f44fdb-b612-4c71-963b-149641dc881f
rm -f vmops.log
rm -f jetty-console.out
args=`getopt npb $*`
if [ $? != 0 ]
then
echo $0 [-p] [-b]
echo specify -p to stop after preparing the test environment
echo specify -b to build cloudstack before starting the test cycle
echo specify -n to activate the noredist profile
exit
fi
set -- $args
for i do
case $i in
-p)
PREPARE=1
;;
-b)
BUILD=1
;;
-n)
NOREDIST=" -Dnoredist "
;;
esac
done
if [ ! -z "${BUILD}" ]
then
echo Building CloudStack
mvn -T 2C -Psystemvm ${NOREDIST} clean install
fi
VBoxManage startvm "${DEVCLOUD_VBOX}"
if [ $? -ne 0 ]
then
echo Failed to start ${DEVCLOUD_VBOX}
fi
VBoxManage startvm ${HYPERVISOR_VBOX}
if [ $? -ne 0 ]
then
echo Failed to start ${HYPERVISOR_VBOX}
fi
echo Fix database host
sed -i "" -e 's/^DBHOST=.*/DBHOST='${DEVCLOUD}'/' build/replace.properties
echo Waiting for database server to become available
COUNT=0
ssh -o BatchMode=true root@${DEVCLOUD} exit
RETVAL=$?
while [ $RETVAL -ne 0 ]
do
sleep 1
echo Trying to connect to ${DEVCLOUD}
ssh -o BatchMode=true root@${DEVCLOUD} exit
RETVAL=$?
done
echo Update the database
mvn -P developer ${NOREDIST} -Ddeploydb -pl developer
echo apply custom fix
ssh -o BatchMode=true root@${DEVCLOUD} 'mysql cloud < fix.sql'
echo Start CloudStack
mvn -P systemvm ${NOREDIST} -pl :cloud-client-ui jetty:run > jetty-console.out 2>&1 &
SERVER_PID=$!
echo Waiting for xen server to become available
COUNT=0
ssh -o BatchMode=true root@${HYPERVISOR} exit
RETVAL=$?
while [ $RETVAL -ne 0 ]
do
sleep 1
echo Trying to connect to ${HYPERVISOR}
ssh -o BatchMode=true root@${HYPERVISOR} exit
RETVAL=$?
done
echo Clean the xenserver
sleep 15
python "${SCRIPT_LOCATION}"/xapi_cleanup_xenservers.py http://${HYPERVISOR} root password
# Check for initialization of the management server
COUNTER=0
while [ "$COUNTER" -lt 34 ] ; do
if grep -q 'Management server node 127.0.0.1 is up' jetty-console.out ; then
break
fi
sleep 5
COUNTER=$(($COUNTER+1))
done
if grep -q 'Management server node 127.0.0.1 is up' jetty-console.out ; then
echo Started OK
sleep 20
echo Provisioning CloudStack with devcloud zone
python "${SCRIPT_LOCATION}"/cloudstack_setup_devcloud.py
python "${SCRIPT_LOCATION}"/cloudstack_checkssvmalive.py
if [ ! -z "${PREPARE}" ] ; then
echo "CloudStack running with PID $SERVER_PID"
exit
fi
sleep 30
python "${SCRIPT_LOCATION}"/cloudstack_test_basic_instance.py
fi
mvn -P systemvm -pl :cloud-client-ui jetty:stop
sleep 30
kill -KILL $SERVER_PID
echo Shutting down test servers
ssh -o BatchMode=true root@${HYPERVISOR} poweroff
sleep 20
ssh -o BatchMode=true root@${DEVCLOUD} poweroff