Move RobotFramework dependencies to csit job
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-controller-run-test.sh
1 # Activate robotframework virtualenv
2 source $WORKSPACE/venv-robotframework/bin/activate
3
4 CONTROLLERMEM="2048m"
5
6 if [ ${CONTROLLERSCOPE} == 'all' ]; then
7     ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
8     CONTROLLERMEM="3072m"
9 else
10     ACTUALFEATURES="${CONTROLLERFEATURES}"
11 fi
12
13 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
14     echo "scriptplan exists!!!"
15     echo "Changing the scriptplan path..."
16     cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
17     cat scriptplan.txt
18     for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
19         echo "Executing ${line}..."
20         source ${line}
21     done
22 fi
23
24 cat > ${WORKSPACE}/controller-script.sh <<EOF
25
26 echo "Changing to /tmp"
27 cd /tmp
28
29 echo "Downloading the distribution..."
30 wget --no-verbose '${ACTUALBUNDLEURL}'
31
32 echo "Extracting the new controller..."
33 unzip -q ${BUNDLE}
34
35 echo "Configuring the startup features..."
36 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
37 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
38 sed -ie "s%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-integration-test/${BUNDLEVERSION}/xml/features%g" \${FEATURESCONF}
39 cat \${FEATURESCONF}
40
41 echo "Configuring the log..."
42 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
43 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' \${LOGCONF}
44 cat \${LOGCONF}
45
46 echo "Configure max memory..."
47 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
48 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
49 cat \${MEMCONF}
50
51 echo "Starting controller..."
52 /tmp/${BUNDLEFOLDER}/bin/start
53
54 echo "Waiting for controller to come up..."
55 COUNT="0"
56 while true; do
57     RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
58     echo \$RESP
59     if [[ \$RESP == *"200"* ]]; then
60         echo Controller is UP
61         break
62     elif (( "\$COUNT" > "600" )); then
63         echo Timeout Controller DOWN
64         echo "Dumping Karaf log..."
65         cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
66         exit 1
67     else
68         COUNT=\$(( \${COUNT} + 5 ))
69         sleep 5
70         echo waiting \$COUNT secs...
71     fi
72 done
73
74 echo "Cool down for 1 min :)..."
75 sleep 60
76
77 echo "Checking OSGi bundles..."
78 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
79
80 EOF
81
82 scp ${WORKSPACE}/controller-script.sh ${CONTROLLER0}:/tmp
83 ssh ${CONTROLLER0} 'bash /tmp/controller-script.sh'
84
85 echo "Changing the testplan path..."
86 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
87 cat testplan.txt
88
89 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
90
91 echo "Starting Robot test suites ${SUITES} ..."
92 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
93 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v CONTROLLER:${CONTROLLER0} -v CONTROLLER_USER:${USER} \
94 -v MININET:${MININET0} -v MININET1:${MININET1} -v MININET2:${MININET2} -v MININET_USER:${USER} \
95 -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
96
97 echo "Fetching Karaf log"
98 scp ${CONTROLLER0}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log .
99
100 # vim: ts=4 sw=4 sts=4 et ft=sh :
101