X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fintegration-deploy-controller-run-test.sh;h=788da938b0c3a20b7220d502fc7bd62c57ce1d28;hb=93a5304ef04620630cbd6de14694607048bf2aa3;hp=c222ed2fc184b6680090b5103ee3b0fd6de050cc;hpb=0a28f0362b904fe414c5dd269f969bf26a94fee1;p=releng%2Fbuilder.git diff --git a/jjb/integration/integration-deploy-controller-run-test.sh b/jjb/integration/integration-deploy-controller-run-test.sh old mode 100644 new mode 100755 index c222ed2fc..788da938b --- a/jjb/integration/integration-deploy-controller-run-test.sh +++ b/jjb/integration/integration-deploy-controller-run-test.sh @@ -6,280 +6,32 @@ source ${ROBOT_VENV}/bin/activate source /tmp/common-functions.sh ${BUNDLEFOLDER} -if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then - echo "Configure cluster" - AKKACONF=/tmp/${BUNDLEFOLDER}/configuration/initial/akka.conf - MODULESCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/modules.conf - MODULESHARDSCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/module-shards.conf -fi - -if [ ${CONTROLLERSCOPE} == 'all' ]; then - ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}" - export CONTROLLERMEM="3072m" - COOLDOWN_PERIOD="180" -else - ACTUALFEATURES="odl-infrautils-ready,${CONTROLLERFEATURES}" - COOLDOWN_PERIOD="60" -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'` -echo "ACTUALFEATURES: ${ACTUALFEATURES}" - -# In the case that we want to install features via karaf shell, a space separated list of -# ACTUALFEATURES IS NEEDED -SPACE_SEPARATED_FEATURES=$(echo "${ACTUALFEATURES}" | tr ',' ' ') -echo "SPACE_SEPARATED_FEATURES: ${SPACE_SEPARATED_FEATURES}" - -if [ -f "${WORKSPACE}/test/csit/scriptplans/${TESTPLAN}" ]; then - echo "scriptplan exists!!!" - echo "Changing the scriptplan path..." - cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt - cat scriptplan.txt - for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do - echo "Executing ${line}..." - # shellcheck source=${line} disable=SC1091 - source ${line} - done -fi - -cat > ${WORKSPACE}/configuration-script.sh <> ${CUSTOMPROP} -fi -cat ${CUSTOMPROP} +run_plan "script" -configure_karaf_log "${KARAF_VERSION}" "${CONTROLLERDEBUGMAP}" +create_configuration_script -set_java_vars "${JAVA_HOME}" "${CONTROLLERMEM}" +create_startup_script -echo "Listing all open ports on controller system..." -netstat -pnatu +create_post_startup_script -if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then +copy_and_run_configuration_script - # Copy shard file if exists - if [ -f /tmp/custom_shard_config.txt ]; then - echo "Custom shard config exists!!!" - echo "Copying the shard config..." - cp /tmp/custom_shard_config.txt /tmp/${BUNDLEFOLDER}/bin/ - fi +run_plan "config" - echo "Configuring cluster" - /tmp/${BUNDLEFOLDER}/bin/configure_cluster.sh \$1 \$2 +copy_and_run_startup_script - echo "Dump akka.conf" - cat ${AKKACONF} - - echo "Dump modules.conf" - cat ${MODULESCONF} - - echo "Dump module-shards.conf" - cat ${MODULESHARDSCONF} -fi - -EOF -# cat > ${WORKSPACE}/configuration-script.sh < ${WORKSPACE}/startup-script.sh < ${WORKSPACE}/startup-script.sh < ${WORKSPACE}/post-startup-script.sh < "600" )); then - echo Timeout Controller DOWN - 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 -pnatu - exit 1 - else - COUNT=\$(( \${COUNT} + 1 )) - sleep 1 - if [[ \$((\$COUNT % 5)) == 0 ]]; then - echo already waited \${COUNT} seconds... - fi - fi -done +copy_and_run_post_startup_script -echo "Listing all open ports on controller system..." -netstat -pnatu - -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 -# cat > ${WORKSPACE}/post-startup-script.sh < configplan.txt - cat configplan.txt - for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do - echo "Executing ${line}..." - # shellcheck source=${line} disable=SC1091 - source ${line} - done -fi - -# Copy over the startup script to controller and execute it. -for i in `seq 1 ${NUM_ODL_SYSTEM}` -do - CONTROLLERIP=ODL_SYSTEM_${i}_IP - echo "Execute the startup script on controller ${!CONTROLLERIP}" - scp ${WORKSPACE}/startup-script.sh ${!CONTROLLERIP}:/tmp - ssh ${!CONTROLLERIP} "bash /tmp/startup-script.sh" -done - -seed_index=1 -for i in `seq 1 ${NUM_ODL_SYSTEM}` -do - CONTROLLERIP=ODL_SYSTEM_${i}_IP - echo "Execute the post startup script on controller ${!CONTROLLERIP}" - scp ${WORKSPACE}/post-startup-script.sh ${!CONTROLLERIP}:/tmp - ssh ${!CONTROLLERIP} "bash /tmp/post-startup-script.sh $(( seed_index++ ))" - if [ $(( $i % (${NUM_ODL_SYSTEM} / ${NUM_OPENSTACK_SITES}) )) == 0 ]; then - seed_index=1 - fi -done - -echo "Cool down for ${COOLDOWN_PERIOD} seconds :)..." -sleep ${COOLDOWN_PERIOD} - -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}" - echo "Lets's take the karaf thread dump" - ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_before.log - pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_before.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') - echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" - ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_before.log || true -done +create_controller_variables if [ ${NUM_OPENSTACK_SYSTEM} -gt 0 ]; then echo "Exiting without running tests to deploy openstack for testing" @@ -293,45 +45,47 @@ do tools_variables=${tools_variables}" -v ${MININETIP}:${!MININETIP}" done -echo "Locating test plan to use..." -testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}" -if [ ! -f "${testplan_filepath}" ]; then - testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}" -fi - -echo "Changing the testplan path..." -cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt -cat testplan.txt - -# Use the testplan if specific SUITES are not defined. -if [ -z "${SUITES}" ]; then - SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '` -else - newsuites="" - workpath="${WORKSPACE}/test/csit/suites" - for suite in ${SUITES}; do - fullsuite="${workpath}/${suite}" - if [ -z "${newsuites}" ]; then - newsuites+=${fullsuite} - else - newsuites+=" "${fullsuite} - fi - done - SUITES=${newsuites} -fi +get_test_suites SUITES echo "Starting Robot test suites ${SUITES} ..." -pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \ --v JAVA_HOME:${JAVA_HOME} -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ --v CONTROLLER:${ODL_SYSTEM_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v ODL_SYSTEM_1_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 JDKVERSION:${JDKVERSION} -v ODL_STREAM:${DISTROSTREAM} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \ --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 -# FIXME: Sort (at least -v) options alphabetically. +robot -N ${TESTPLAN} \ + --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} \ + -v BUNDLEFOLDER:${BUNDLEFOLDER} \ + -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \ + -v CONTROLLER:${ODL_SYSTEM_IP} \ + -v CONTROLLER_USER:${USER} \ + -v GERRIT_BRANCH:${GERRIT_BRANCH} \ + -v GERRIT_PROJECT:${GERRIT_PROJECT} \ + -v GERRIT_REFSPEC:${GERRIT_REFSPEC} \ + -v JAVA_HOME:${JAVA_HOME} \ + -v JDKVERSION:${JDKVERSION} \ + -v JENKINS_WORKSPACE:${WORKSPACE} \ + -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:${TOOLS_SYSTEM_IP} \ + -v MININET_USER:${USER} \ + -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ + -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \ + -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \ + -v ODL_STREAM:${DISTROSTREAM} \ + -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_IP} \ + -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \ + -v ODL_SYSTEM_USER:${USER} \ + -v SUITES:"${SUITES}" \ + -v TOOLS_SYSTEM_1_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_IP:${TOOLS_SYSTEM_IP} \ + -v TOOLS_SYSTEM_USER:${USER} \ + -v USER_HOME:${HOME} \ + -v WORKSPACE:/tmp \ + ${TESTOPTIONS} ${SUITES} || true echo "Examining the files in data/log and checking filesize" ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/" @@ -344,7 +98,7 @@ do ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" - ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true + ssh ${!CONTROLLERIP} "${JAVA_HOME}/bin/jstack -l ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true echo "Killing ODL" set +e # We do not want to create red dot just because something went wrong while fetching logs. ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'