X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Finclude-raw-integration-deploy-controller-run-test.sh;h=536458cf7a67166b15beffb2596260d34e3fb0ba;hb=0657ecce96be698fec0d14c2801bddff5936eda5;hp=435ac9f3baa76ad2531c47b78479059c7f643417;hpb=67105890d2c8b760d901a6948291915021799d8d;p=releng%2Fbuilder.git diff --git a/jjb/integration/include-raw-integration-deploy-controller-run-test.sh b/jjb/integration/include-raw-integration-deploy-controller-run-test.sh index 435ac9f3b..536458cf7 100644 --- a/jjb/integration/include-raw-integration-deploy-controller-run-test.sh +++ b/jjb/integration/include-raw-integration-deploy-controller-run-test.sh @@ -1,3 +1,4 @@ +#@IgnoreInspection BashAddShebang # Activate robotframework virtualenv # ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh # script. @@ -11,6 +12,9 @@ if [ ${CONTROLLERSCOPE} == 'all' ]; then else ACTUALFEATURES="${CONTROLLERFEATURES}" fi +# Some versions of jenkins job builder result in feature list containing spaces +# and ending in newline. Remove all that. +ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'` if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then echo "scriptplan exists!!!" @@ -25,6 +29,19 @@ fi cat > ${WORKSPACE}/controller-script.sh < "600" )); then echo Timeout Controller DOWN - echo "Dumping Karaf log..." - cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log + echo "Dumping first 500K bytes of karaf log..." + head --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Dumping last 500K bytes of karaf log..." + tail --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Listing all open ports on controller system" + netstat -natu exit 1 else COUNT=\$(( \${COUNT} + 5 )) @@ -76,13 +105,28 @@ done echo "Cool down for 1 min :)..." sleep 60 -echo "Checking OSGi bundles..." -sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list' +echo "Listing all open ports on controller system..." +netstat -natu + +function exit_on_log_file_message { + echo "looking for \"\$1\" in log file" + if grep --quiet "\$1" /tmp/${BUNDLEFOLDER}/data/log/karaf.log; then + echo ABORTING: found "\$1" + echo "Dumping first 500K bytes of karaf log..." + head --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Dumping last 500K bytes of karaf log..." + tail --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + exit 1 + fi +} + +exit_on_log_file_message 'BindException: Address already in use' +exit_on_log_file_message 'server is unhealthy' EOF -scp ${WORKSPACE}/controller-script.sh ${CONTROLLER0}:/tmp -ssh ${CONTROLLER0} 'bash /tmp/controller-script.sh' +scp ${WORKSPACE}/controller-script.sh ${ODL_SYSTEM_IP}:/tmp +ssh ${ODL_SYSTEM_IP} 'bash /tmp/controller-script.sh' echo "Changing the testplan path..." cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt @@ -92,12 +136,23 @@ SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' echo "Starting Robot test suites ${SUITES} ..." pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \ --v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v CONTROLLER:${CONTROLLER0} -v CONTROLLER_USER:${USER} \ --v MININET:${MININET0} -v MININET1:${MININET1} -v MININET2:${MININET2} -v MININET_USER:${USER} \ --v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true - -echo "Fetching Karaf log" -scp ${CONTROLLER0}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log . +-v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ +-v CONTROLLER:${ODL_SYSTEM_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} \ +-v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \ +-v TOOLS_SYSTEM_4_IP:${TOOLS_SYSTEM_4_IP} -v TOOLS_SYSTEM_5_IP:${TOOLS_SYSTEM_5_IP} -v TOOLS_SYSTEM_6_IP:${TOOLS_SYSTEM_6_IP} \ +-v TOOLS_SYSTEM_USER:${USER} \ +-v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} \ +-v MININET3:${TOOLS_SYSTEM_4_IP} -v MININET4:${TOOLS_SYSTEM_5_IP} -v MININET5:${TOOLS_SYSTEM_6_IP} \ +-v MININET_USER:${USER} -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true + +echo "Killing ODL and fetching Karaf log..." +set +e # We do not want to create red dot just because something went wrong while fetching logs. +ssh "${ODL_SYSTEM_IP}" tail --bytes=1M "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" > "karaf.log" +ssh "${ODL_SYSTEM_IP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh' +sleep 5 +ssh "${ODL_SYSTEM_IP}" xz -9ekvv "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" +scp "${ODL_SYSTEM_IP}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log.xz" . +true # perhaps Jenkins is testing last exit code # vim: ts=4 sw=4 sts=4 et ft=sh :