diff options
author | JulienBe <julien.bertozzi@intl.att.com> | 2020-09-03 17:09:46 +0200 |
---|---|---|
committer | Xue Gao <xg353y@intl.att.com> | 2020-09-07 12:18:23 +0000 |
commit | 61663b92910868a4de51c6fe9a7cef7da96da7e9 (patch) | |
tree | 86085699100a83f9de49375b635596601b55502d /test-apis-ci/src/main/resources/ci/scripts | |
parent | bcee4648917b2442f51a75639708bad4cd0fe4ad (diff) |
Optimize Build
Optimize the log output
Issue-ID: SDC-3232
Signed-off-by: JulienBe <julien.bertozzi@intl.att.com>
Change-Id: I50cfb7119b1e9087d3e2db56a81fe47df4ad6254
Diffstat (limited to 'test-apis-ci/src/main/resources/ci/scripts')
4 files changed, 0 insertions, 350 deletions
diff --git a/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh deleted file mode 100644 index e695db26b2..0000000000 --- a/test-apis-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -function help_usage () -{ - echo "$0 -ip <ip> -f <userToAdd_file>" - 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/test-apis-ci/src/main/resources/ci/scripts/copyToStorage.sh b/test-apis-ci/src/main/resources/ci/scripts/copyToStorage.sh deleted file mode 100644 index b7b8c09715..0000000000 --- a/test-apis-ci/src/main/resources/ci/scripts/copyToStorage.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -REPORT_NAME=$1 -VERSION=$2 -ENV=$3 - -if [ -z "$REPORT_NAME" ] - then - source ExtentReport/versions.info - now=$(date -d '+7 hour' "+%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 - -echo ${IP} - -/usr/bin/expect << EOF -spawn ssh admin@${IP} mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/APIs/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send ${PASS}\r - } -} - -expect eof - -spawn scp -r ExtentReport admin@${IP}:/home/admin/reports/${ENV}/${VERSION}/APIs/${REPORT_NAME}/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send ${PASS}\r - } -} - -expect eof - -spawn ssh admin@${IP} chmod -R 775 /home/admin/reports/${ENV}/${VERSION}/APIs/${REPORT_NAME}/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send ${PASS}\r - } -} - -expect eof - -EOF diff --git a/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh b/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh deleted file mode 100644 index 979d091d00..0000000000 --- a/test-apis-ci/src/main/resources/ci/scripts/sendMail.sh +++ /dev/null @@ -1,46 +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@intl.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 - now=$(date -d '+7 hour' "+%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}'/APIs/'${REPORT_NAME}'/SDC_CI_Extent_Report.html \n\nThanks, \nSDC 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 'External APIs Automation '$ENV' results - ASDC '$VERSION -r 'ASDC@Automation.team' $RECIPIENTS diff --git a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh b/test-apis-ci/src/main/resources/ci/scripts/startTest.sh deleted file mode 100644 index f8285ef506..0000000000 --- a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -REMOTE_DEBUG=false -RERUN=false -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/log4j2.properties -############################################# -TARGET_DIR=${FULL_PATH}/target -CONF_FILE=${FULL_PATH}/conf/attsdc.yaml - -DEBUG=true -MainClass=org.openecomp.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}/" - -######ADD USERS################ - -BE_IP=`cat conf/attsdc.yaml | grep catalogBeHost| awk '{print $2}'` - -ADD_USERS_SCRIPT="addUsersFromList_new.sh" -USER_LIST="conf/userList.txt" -chmod +x ${ADD_USERS_SCRIPT} -echo "add users..." -./${ADD_USERS_SCRIPT} -ip ${BE_IP} -f ${USER_LIST} - - - -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} -Dorg.freemarker.loggerLibrary=none -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} -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} - -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 |