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