From 61663b92910868a4de51c6fe9a7cef7da96da7e9 Mon Sep 17 00:00:00 2001 From: JulienBe Date: Thu, 3 Sep 2020 17:09:46 +0200 Subject: Optimize Build Optimize the log output Issue-ID: SDC-3232 Signed-off-by: JulienBe Change-Id: I50cfb7119b1e9087d3e2db56a81fe47df4ad6254 --- .../resources/ci/scripts/addUsersFromList_new.sh | 80 --------- .../src/main/resources/ci/scripts/copyToStorage.sh | 55 ------- ui-ci/src/main/resources/ci/scripts/sendMail.sh | 50 ------ ui-ci/src/main/resources/ci/scripts/startTest.sh | 181 --------------------- 4 files changed, 366 deletions(-) delete mode 100644 ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh delete mode 100644 ui-ci/src/main/resources/ci/scripts/copyToStorage.sh delete mode 100644 ui-ci/src/main/resources/ci/scripts/sendMail.sh delete mode 100644 ui-ci/src/main/resources/ci/scripts/startTest.sh (limited to 'ui-ci/src/main/resources/ci/scripts') diff --git a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh deleted file mode 100644 index e695db26b2..0000000000 --- a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -function help_usage () -{ - echo "$0 -ip -f " - echo "for example: -ip 127.0.0.1 -f /var/tmp/userToAdd.txt" - exit -} - -function check_file_existance () -{ -echo "check_file_existance $1" -if [ $1 == "" ]; then - echo "Please provide full path to user file" - exit; -elif [ -f $1 ]; then - source $1 - USERS=("${USER_LIST[@]}") - echo "file exist" $1 -else - echo "Provided user file does not exist" - exit -fi -} - -function check_ip_existance () -{ -if [ $1 == "" ]; then - echo "Please provide ip address" - exit; -fi -} - -function addUser () -{ - #for user in "${USER_LIST[@]}"; do - for user in "${USERS[@]}"; do - PING=`ping -c 1 $IP > /var/tmp/ping.log` - pattern1='100% packet loss' - pattern2='Host Unreachable' - COUNT=`egrep -c "$pattern1|$pattern2" /var/tmp/ping.log` - if [ $COUNT -eq 0 ]; then - # curl -i -X post -d '{ "userId" : "kk1123", "role" : "ADMIN" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" http://192.168.111.9:8080/sdc2/rest/v1/user - userId=`echo $user|awk '{print $1}'` - role=`echo $user|awk '{print $2}'` - firstName=`echo $user|awk '{print $3}'` - lastName=`echo $user|awk '{print $4}'` - email=`echo $user|awk '{print $5}'` - curl --noproxy '*' -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'", "firstName" : "'${firstName}'", "lastName" : "'${lastName}'", "email" : "'${email}'" }' -H "Content-Type: application/json" -H "USER_ID: jh0003" https://${IP}:8443/sdc2/rest/v1/user - else - echo "Host" $IP "Is Unreachable" - fi - done -curl --noproxy '*' -i -X post -d '{"consumerName": "ci","consumerSalt": "2a1f887d607d4515d4066fe0f5452a50","consumerPassword": "0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b"}' -H "Content-Type: application/json" -H "USER_ID: jh0003" -H "Authorization:Basic Y2k6MTIzNDU2" https://${IP}:8443/sdc2/rest/v1/consumers - -} - -#main -[ $# -eq 0 ] && help_usage -while [ $# -ne 0 ]; do - case $1 in - "-f") - USER_FILE=$2 - shift 1 - shift 1 - ;; - -ip) - IP=$2 - shift 1 - shift 1 - ;; - *) -# help_usage - ;; - esac -done - -check_file_existance $USER_FILE -check_ip_existance $IP -addUser diff --git a/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh b/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh deleted file mode 100644 index a113c54e60..0000000000 --- a/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/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 - -source conf/attInternal.info -IP=$automationResutlsRepo -PASS=$automationResutlsRepoPass - -/usr/bin/expect << EOF -spawn ssh admin@${IP} mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send ${PASS}\r - } -} - -expect eof - -spawn scp -pr ExtentReport admin@${IP}:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send ${PASS}\r - } -} - -expect eof -EOF diff --git a/ui-ci/src/main/resources/ci/scripts/sendMail.sh b/ui-ci/src/main/resources/ci/scripts/sendMail.sh deleted file mode 100644 index 932b624a33..0000000000 --- a/ui-ci/src/main/resources/ci/scripts/sendMail.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -now=$(date +'%Y%-m%d%H%M') - -REPORT_NAME=$1 -VERSION=$2 -ENV=$3 - -RECIPIENTS1="md9897@att.com,NETCOM_ASDC_DEV@att.com,IL-D2-QA-Alex@att.com,bs5719@att.com,yg356h@att.com,yr9970@att.com,sl615n@att.com,yn813h@att.com,as221v@att.com,ms172g@att.com,ma2244@att.com,el489u@att.com,gg980r@att.com,ak991p@att.com,bv095y@att.com,ms656r@att.com,df502y@att.com,bt750h@att.com,ln699k@att.com,hm104p@att.com" -#RECIPIENTS2="dl-asdcqa@att.com" -RECIPIENTS2="md9897@att.com,NETCOM_ASDC_DEV@att.com,IL-D2-QA-Alex@att.com,bs5719@att.com,yg356h@att.com,yr9970@att.com,sl615n@att.com,yn813h@att.com,as221v@att.com,ms172g@att.com,ma2244@att.com,el489u@att.com,gg980r@att.com,ak991p@att.com,bv095y@att.com,ms656r@att.com,df502y@att.com,bt750h@att.com,ln699k@att.com,hm104p@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/ui-ci/src/main/resources/ci/scripts/startTest.sh b/ui-ci/src/main/resources/ci/scripts/startTest.sh deleted file mode 100644 index 20afd86414..0000000000 --- a/ui-ci/src/main/resources/ci/scripts/startTest.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/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 ( ) [-r/rerun -d/debug ]" - 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 '/ ${FULL_PATH}/${TEST_SUITES}/${fileName} - sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName} - if [ -s "ExtentReport/ShortReport.csv" ] - then - SKIP_TESTS_LIST=$(cat ExtentReport/ShortReport.csv |awk -F, '{print $2}' | sed 's/&.*//g' | uniq) - for SKIP_TEST in ${SKIP_TESTS_LIST}; do - sed -i "s/.*\"${SKIP_TEST}\".*//g" ${FULL_PATH}/${TEST_SUITES}/${fileName}; - done; - fi -} - -function setUpdatedTimeToReport () -{ - LINE_NUMBER_OF_START_REPORT_DATE=`grep -A1 -nw "Start" ExtentReport/SDC_UI_Extent_Report.html | tail -1 | awk '{print $1}' | tr -d -` - END_REPORT_DATE=`grep -A1 -nw "End" ExtentReport/SDC_UI_Extent_Report.html | tail -1 | awk -F'[>|<]' '{print $3}'` - EPOCH_START_REPORT_DATE=`date --date="${1}" +%s` - EPOCH_END_REPORT_DATE=`date --date="${END_REPORT_DATE}" +%s` - let DIFF_EPOCH_TIME=${EPOCH_END_REPORT_DATE}-${EPOCH_START_REPORT_DATE} - TAKEN_TIME_IN_MINUTES=`echo $((${DIFF_EPOCH_TIME}/60))` - LINE_NUMBER_OF_TAKEN_REPORT_TIME=`grep -A1 -nw "Time Taken" ExtentReport/SDC_UI_Extent_Report.html | tail -1 | awk '{print $1}' | tr -d -` - PATTERN="div class='panel-lead'>"; - sed -i "${LINE_NUMBER_OF_START_REPORT_DATE}s/${PATTERN}.*\> /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} -Dorg.freemarker.loggerLibrary=none -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} -REPORT_START_DATE=${reportStartTime} - -if [ ${RERUN} == "true" ]; then - setUpdatedTimeToReport "${REPORT_START_DATE}"; -fi - -if [[ $env == *"DEV20"* ]] -then - MYENV="Nightly" -else - MYENV="" -fi - -COPY_REPORT_SCRIPT="copyToStorage.sh" -chmod +x ${COPY_REPORT_SCRIPT} -echo "copy report to storage..." -( ./${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 -- cgit 1.2.3-korg