X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Finclude-raw-integration-start-cluster-run-test.sh;h=adba827fb0602b71f99a09b8c47abfa1a3c86192;hb=d43f4866e62eb986c67749a0f68f8a658ab8f252;hp=4f74dc9086b70e9a18d0b914fc9b721a8bf14433;hpb=6b812c1a38b56101b15babe2efc8b877b54cdca9;p=releng%2Fbuilder.git diff --git a/jjb/integration/include-raw-integration-start-cluster-run-test.sh b/jjb/integration/include-raw-integration-start-cluster-run-test.sh index 4f74dc908..adba827fb 100644 --- a/jjb/integration/include-raw-integration-start-cluster-run-test.sh +++ b/jjb/integration/include-raw-integration-start-cluster-run-test.sh @@ -1,3 +1,4 @@ +#@IgnoreInspection BashAddShebang # Activate robotframework virtualenv # ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh # script. @@ -25,7 +26,7 @@ while true; do elif (( "\$COUNT" > "600" )); then echo Timeout Controller DOWN echo "Dumping Karaf log..." - cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log + head --bytes=1M "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" echo "Listing all open ports on controller system" netstat -natu exit 1 @@ -36,28 +37,30 @@ while true; do fi done -echo "Checking OSGi bundles..." -sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list' - -echo "Listing all open ports on controller system" +echo "Listing all open ports on controller system.." netstat -natu -# checking for any bind exceptions in log which could indicate a port conflict -if grep --quiet 'BindException: Address already in use' /tmp/${BUNDLEFOLDER}/data/log/karaf.log; then - echo BindException found: Possible port conflict - echo "Dumping Karaf log..." - cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log - exit 1 -fi +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 Karaf log..." + head --bytes=1M "/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 -ODL_SYSTEM_IPS=(${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}) -for i in "${!ODL_SYSTEM_IPS[@]}" +for i in `seq 1 ${NUM_ODL_SYSTEM}` do - echo "Verifying member-$((i+1)) with IP address ${ODL_SYSTEM_IPS[$i]} is UP" - scp ${WORKSPACE}/verify-cluster-is-up.sh ${ODL_SYSTEM_IPS[$i]}:/tmp - ssh ${ODL_SYSTEM_IPS[$i]} "bash /tmp/verify-cluster-is-up.sh $((i+1)) ${ODL_SYSTEM_IPS[$i]}" + CONTROLLERIP=ODL_SYSTEM_${i}_IP + echo "Verifying member-${i} with IP address ${!CONTROLLERIP} is UP" + scp ${WORKSPACE}/verify-cluster-is-up.sh ${!CONTROLLERIP}:/tmp + ssh ${!CONTROLLERIP} "bash /tmp/verify-cluster-is-up.sh ${i} ${!CONTROLLERIP}" done echo "Cool down for 1 min :)..." @@ -67,22 +70,46 @@ echo "Changing the testplan path..." cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt cat testplan.txt -SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' ) +SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '` + +echo "Generating controller variables..." +for i in `seq 1 ${NUM_ODL_SYSTEM}` +do + CONTROLLERIP=ODL_SYSTEM_${i}_IP + odl_variables=${odl_variables}" -v ${CONTROLLERIP}:${!CONTROLLERIP}" +done + +echo "Generating mininet variables..." +for i in `seq 1 ${NUM_TOOLS_SYSTEM}` +do + MININETIP=TOOLS_SYSTEM_${i}_IP + tools_variables=${tools_variables}" -v ${MININETIP}:${!MININETIP}" +done 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:${ODL_SYSTEM_IP} -v CONTROLLER1:${ODL_SYSTEM_2_IP} \ --v CONTROLLER2:${ODL_SYSTEM_3_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \ --v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_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_USER:${USER} \ +pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ +-v CONTROLLER:${ODL_SYSTEM_IP} -v CONTROLLER1:${ODL_SYSTEM_2_IP} -v CONTROLLER2:${ODL_SYSTEM_3_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \ +${odl_variables} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} -v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} -v \ +TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} ${tools_variables} -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} -v TOOLS_SYSTEM_USER:${USER} \ -v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} -v MININET_USER:${USER} \ -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true -echo "Fetching Karaf log" -scp $ODL_SYSTEM_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller0-karaf.log -scp $ODL_SYSTEM_2_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller1-karaf.log -scp $ODL_SYSTEM_3_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller2-karaf.log +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. +for i in `seq 1 ${NUM_ODL_SYSTEM}` +do + CONTROLLERIP=ODL_SYSTEM_${i}_IP + ssh "${!CONTROLLERIP}" head --bytes=1M "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" > "odl${i}_karaf.log" + ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh' +done +sleep 5 +for i in `seq 1 ${NUM_ODL_SYSTEM}` +do + CONTROLLERIP=ODL_SYSTEM_${i}_IP + ssh "${!CONTROLLERIP}" xz -9ekvv "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + scp "${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log.xz" "odl${i}_karaf.log.xz" +done +true # perhaps Jenkins is testing last exit code # vim: ts=4 sw=4 sts=4 et ft=sh :