aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/resources/ci
diff options
context:
space:
mode:
authorAmichai Hemli <ah0398@intl.att.com>2019-03-18 10:07:02 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-18 10:07:02 +0000
commita036637a4d466662128cde1823816578e76c69e0 (patch)
treed58add45a75701717e67de676463fc6b15068f9d /vid-automation/src/main/resources/ci
parent756a9c041981e05a3f5bd740ebc0d3fc22579003 (diff)
parent66af8b9b391879be78660d6ccb0a1f1f9340b423 (diff)
Merge "Merge automation from ECOMP's repository"
Diffstat (limited to 'vid-automation/src/main/resources/ci')
-rw-r--r--vid-automation/src/main/resources/ci/conf/log4j.properties4
-rw-r--r--vid-automation/src/main/resources/ci/scripts/copyToStorage.sh50
-rw-r--r--vid-automation/src/main/resources/ci/scripts/sendMail.sh49
-rw-r--r--vid-automation/src/main/resources/ci/scripts/startTest.sh141
4 files changed, 242 insertions, 2 deletions
diff --git a/vid-automation/src/main/resources/ci/conf/log4j.properties b/vid-automation/src/main/resources/ci/conf/log4j.properties
index 3e159ec8d..bef72a99f 100644
--- a/vid-automation/src/main/resources/ci/conf/log4j.properties
+++ b/vid-automation/src/main/resources/ci/conf/log4j.properties
@@ -28,7 +28,7 @@ log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:
log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
-log4j.logger.org.openecomp.sdc.ci.tests.utils=TRACE, FILE, stdout
-log4j.additivity.org.openecomp.sdc.ci.tests.utils=false
+log4j.logger.org.onap.sdc.ci.tests.utils=TRACE, FILE, stdout
+log4j.additivity.org.onap.sdc.ci.tests.utils=false
diff --git a/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh b/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh
new file mode 100644
index 000000000..86fcadfef
--- /dev/null
+++ b/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+REPORT_NAME=$1
+VERSION=$2
+ENV=$3
+
+if [ -z "$REPORT_NAME" ]
+ then
+ source ExtentReport/versions.info
+ now=$(date +'%Y-%m-%d_%H_%M')
+ REPORT_NAME="${now}"
+ VERSION="${osVersion}"
+ if [[ $env == *"DEV20"* ]]
+ then
+ ENV="Nightly"
+ else
+ ENV=""
+ fi
+
+ fi
+
+/usr/bin/expect << EOF
+spawn ssh admin@135.76.210.45 mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/
+
+expect {
+ -re ".*es.*o.*" {
+ exp_send "yes\r"
+ exp_continue
+ }
+ -re ".*sword.*" {
+ exp_send "Aa123456\r"
+ }
+}
+
+expect eof
+
+spawn scp -pr ExtentReport admin@135.76.210.45:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/
+
+expect {
+ -re ".*es.*o.*" {
+ exp_send "yes\r"
+ exp_continue
+ }
+ -re ".*sword.*" {
+ exp_send "Aa123456\r"
+ }
+}
+
+expect eof
+EOF
diff --git a/vid-automation/src/main/resources/ci/scripts/sendMail.sh b/vid-automation/src/main/resources/ci/scripts/sendMail.sh
new file mode 100644
index 000000000..794534fc8
--- /dev/null
+++ b/vid-automation/src/main/resources/ci/scripts/sendMail.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+now=$(date +'%Y%-m%d%H%M')
+
+REPORT_NAME=$1
+VERSION=$2
+ENV=$3
+
+RECIPIENTS1="dl-sdcqa@intl.att.com,ml636r@intl.att.com,bl5783intl.att.com,ak314p@intl.att.com,el489u@intl.att.com,hk096q@intl.att.com,bs5719@intl.att.com"
+RECIPIENTS2="dl-asdcqa@intl.att.com"
+
+source ExtentReport/versions.info
+if [ -z "$REPORT_NAME" ]
+ then
+ source ExtentReport/versions.info
+ now=$(date +'%Y-%m-%d_%H_%M')
+ REPORT_NAME="${now}"
+ VERSION="${osVersion}"
+
+
+fi
+
+if [[ $env == *"DEV20"* ]]
+ then
+ ENV="Nightly"
+ RECIPIENTS=$RECIPIENTS1
+ else
+ ENV=""
+ RECIPIENTS=$RECIPIENTS2
+fi
+
+#REPORT_ZIP_FILE=ExtentReport_${now}.zip
+REPORT_FOLDER='ExtentReport'
+REPORT_HTML_FILE=${REPORT_FOLDER}/*Report.html
+BODY_MESSAGE='Hello, \n\n Please find automation results on following link: \n\n http://asdc-srv-210-45.tlv.intl.att.com/'${ENV}'/'${VERSION}'/UI/'${REPORT_NAME}'/SDC_UI_Extent_Report.html \n\nThanks, \nASDC QA Team\n\n '
+
+#OLD_FILE=$(find ./ -type f -name ${REPORT_ZIP_FILE} -print)
+#if [ ! -z ${OLD_FILE} ]
+#then
+# rm -f ${REPORT_ZIP_FILE}
+# echo "Removing old zip file............"
+#fi
+
+#echo "Creating new zip file"
+#zip -r ${REPORT_ZIP_FILE} ./${REPORT_FOLDER}
+
+
+
+echo -e ${BODY_MESSAGE} | mail -s 'E2E Automation '$ENV' results - SDC '$VERSION -r 'ASDC@Automation.team' $RECIPIENTS
diff --git a/vid-automation/src/main/resources/ci/scripts/startTest.sh b/vid-automation/src/main/resources/ci/scripts/startTest.sh
new file mode 100644
index 000000000..e4c1a0995
--- /dev/null
+++ b/vid-automation/src/main/resources/ci/scripts/startTest.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+REMOTE_DEBUG=false
+RERUN=true
+JAVA_OPTION=""
+debug_port=8000
+TEST_SUITES=testSuites
+fileName=testng-failed.xml
+
+function help_usage ()
+{
+ echo
+ echo "$0 (<jar_file_name> <suite file name>) [-r/rerun <true/false> -d/debug <true/false>]"
+ echo "nohup ./startTest.sh ui-ci-1707.0.5-SNAPSHOT-jar-with-dependencies.jar extendedSanity.xml -r false -d true &"
+ echo "by default rerun is true and remote debug is false."
+ echo
+ exit 2
+}
+
+function isBoolean ()
+{
+ PARAM_NAME=$1
+ VALUE=$2
+ if [[ ${VALUE} != "true" ]] && [[ ${VALUE} != "false" ]]; then
+ echo "Valid parameter" ${PARAM_NAME} "values are: true/false"
+ help_usage
+ fi
+}
+
+function prepareFailedXmlFile ()
+{
+ echo "1="$1 "2="$2 "fileName="${fileName}
+ PATTERN=`grep -w "test name=" ${FULL_PATH}/${TEST_SUITES}/$2 | awk -F'"' '{print $2}'`
+ sed '/<test name="'${PATTERN}'"/,/<!-- '${PATTERN}' --/d' $1 > ${FULL_PATH}/${TEST_SUITES}/${fileName}
+ sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName}
+}
+
+#main
+[ $# -lt 2 ] && help_usage
+
+JAR_FILE=$1
+SUITE_FILE=$2
+
+while [ $# -ne 0 ]; do
+ case $1 in
+ -r|rerun)
+ RERUN=$2
+ isBoolean $1 ${RERUN}
+ shift 1
+ shift 1
+ ;;
+ -d|debug)
+ REMOTE_DEBUG=$2
+ isBoolean $1 ${REMOTE_DEBUG}
+ shift 1
+ shift 1
+ ;;
+ *)
+ shift 1
+ ;;
+ esac
+done
+
+CURRENT_DIR=`pwd`
+BASEDIR=$(dirname $0)
+
+if [ ${BASEDIR:0:1} = "/" ]
+then
+ FULL_PATH=$BASEDIR
+else
+ FULL_PATH=$CURRENT_DIR/$BASEDIR
+fi
+LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
+#############################################
+TARGET_DIR=${FULL_PATH}/target
+CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
+
+DEBUG=true
+MainClass=org.onap.sdc.ci.tests.run.StartTest
+
+TESTS_DIR=/opt/app/sdc/ci/resources/tests
+COMPONENTS_DIR=/opt/app/sdc/ci/resources/components
+
+
+TARGET_LOG_DIR="${TARGET_DIR}/"
+
+if [ ${REMOTE_DEBUG} == "true" ]; then
+ echo "Debug mode, Listen on port $debug_port";
+ JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;
+fi
+
+cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+
+
+if [ $DEBUG == "true" ]
+then
+ $cmd
+else
+ $cmd >> /dev/null
+fi
+
+if [ ${RERUN} == "true" ]; then
+ if [ -f ${TARGET_DIR}/${fileName} ]; then
+ echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ...";
+ prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE;
+ SUITE_FILE=${fileName};
+ cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+ $cmd;
+ fi
+fi
+
+status=`echo $?`
+
+source ExtentReport/versions.info
+now=$(date +'%Y-%m-%d_%H_%M')
+REPORT_NAME=${now}
+VERSION=${osVersion}
+
+if [[ $env == *"DEV20"* ]]
+then
+ MYENV="Nightly"
+else
+ MYENV=""
+fi
+
+COPY_REPORT_SCRIPT="copyToStorage.sh"
+chmod +x ${COPY_REPORT_SCRIPT}
+echo "copy report to storage..."
+sh ./${COPY_REPORT_SCRIPT} ${REPORT_NAME} ${VERSION} ${MYENV}
+
+
+MAILING_SCRIPT_NAME="sendMail.sh"
+chmod +x ${MAILING_SCRIPT_NAME}
+echo "Sending report via mail..."
+`./${MAILING_SCRIPT_NAME} ${REPORT_NAME} ${VERSION} ${MYENV}`
+
+
+echo "##################################################"
+echo "################# status is ${status} #################"
+echo "##################################################"
+
+exit $status