From: Yuli Shlosberg Date: Tue, 12 Sep 2017 11:11:48 +0000 (+0300) Subject: Build sanity docker execute automation X-Git-Tag: v1.2.0~888^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=9dde926417f80d93f4159be8164ed5b3d8790a75;p=sdc.git Build sanity docker execute automation Change-Id: Iab282ea167d12fba4a3f425a5d300397ab435b44 Issue-Id: SDC-315 Signed-off-by: Michael Lando --- diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 0a7f439d7e..b3aa4d6493 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -35,7 +35,7 @@ 2.1.1 - 1.1.0-SNAPSHOT + ${project.version} 1.1.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 4a9be30637..6aa5c830c5 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,6 @@ 1.2.0-SNAPSHOT pom sdc - @@ -28,10 +27,10 @@ 2.24 2.5 - 1.1.0-SNAPSHOT - 1.1.0-SNAPSHOT + ${project.version} + ${project.version} 1.1.0 - 1.1.0-SNAPSHOT + ${project.version} 2.1.0 diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml index f7e1eaca78..1e24e26d72 100644 --- a/sdc-os-chef/pom.xml +++ b/sdc-os-chef/pom.xml @@ -1,43 +1,45 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 4.0.0 + 4.0.0 - sdc-os-chef + sdc-os-chef - - org.openecomp.sdc - sdc-main + + org.openecomp.sdc + sdc-main 1.2.0-SNAPSHOT - + - - ${project.version}-${maven.build.timestamp} - ${project.version}-latest - + + ${project.version}-${maven.build.timestamp} + ${project.version}-latest + - - - - maven-clean-plugin - 3.0.0 - - - clean.tosca.chef.os.folder - clean - - clean - - - - - ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\ - false - - **/default.rb - - + + + + maven-clean-plugin + 3.0.0 + + + clean.tosca.chef.os.folder + clean + + clean + + + + + + ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\ + + false + + **/default.rb + + ${project.parent.basedir}/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default @@ -48,77 +50,83 @@ logback.xml - - - - - - - ru.yaal.maven - write-text-files-maven-plugin - 1.1 - - UTF-8 - - - ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\default.rb - - normal['version'] = "${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" - - - - - - - write-text-files - prepare-package - - write-text-files - - - - - - + + + + + + + ru.yaal.maven + write-text-files-maven-plugin + 1.1 + + UTF-8 + + + + ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\default.rb + + + normal['version'] = + "${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + + + + + + + + write-text-files + prepare-package + + write-text-files + + + + + + - - - docker-staging - - ${project.version}-STAGING-${maven.build.timestamp} - ${project.version}-STAGING-latest - - + + + docker-staging + + ${project.version}-STAGING-${maven.build.timestamp} + ${project.version}-STAGING-latest + + - - docker - - false - - - - - maven-resources-plugin - 3.0.2 - - - copy-resources-apidocs - validate - - copy-resources - - - ${basedir}/sdc-backend - - - ${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs - - api-docs.war - - - - - + + docker + + false + + + + + maven-resources-plugin + 3.0.2 + + + copy-resources-apidocs + validate + + copy-resources + + + ${basedir}/sdc-backend + + + + ${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs + + + api-docs.war + + + + + copy-static-configuration-files @@ -142,185 +150,224 @@ - - copy-resources-be - validate - - copy-resources - - - ${basedir}/sdc-backend - - - ${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target - - onboarding-be-${project.version}.war - - - - - - - copy-resources-fe - validate - - copy-resources - - - ${basedir}/sdc-frontend - - - ${project.parent.basedir}/openecomp-ui/target - - onboarding-fe-${project.version}.war - - - - - - - - + + copy-resources-be + validate + + copy-resources + + + ${basedir}/sdc-backend + + + + ${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target + + + onboarding-be-${project.version}.war + + + + + + + copy-resources-fe + validate + + copy-resources + + + ${basedir}/sdc-frontend + + + ${project.parent.basedir}/openecomp-ui/target + + onboarding-fe-${project.version}.war + + + + + + + copy-tests-suites + validate + + copy-resources + + + sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites + + + ${project.parent.basedir}/test-apis-ci/src/main/resources/ci/testSuites + + * + + + + + + + copy-resources-test-apis-ci + validate + + copy-resources + + + ${basedir}/sdc-sanity + + + ${project.parent.basedir}/test-apis-ci/target + + test-apis-ci-${project.version}-jar-with-dependencies.jar + + + + + + + - - io.fabric8 - docker-maven-plugin - 0.22.1 + + io.fabric8 + docker-maven-plugin + 0.19.1 - - false - 1.23 + + true + 1.23 - + - - - openecomp/sdc-backend - sdc-backend - - try - ${project.basedir}/sdc-backend - - ${docker.tag} - ${docker.latest.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - + + + openecomp/sdc-backend + sdc-backend + + try + ${project.basedir}/sdc-backend + + ${docker.tag} + ${docker.latest.tag}$sedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + - - - openecomp/sdc-frontend - sdc-frontend - - try - ${project.basedir}/sdc-frontend - - ${docker.tag} - ${docker.latest.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - + + + openecomp/sdc-frontend + sdc-frontend + + try + ${project.basedir}/sdc-frontend + + ${docker.tag} + ${docker.latest.tag} + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + - - - openecomp/sdc-elasticsearch - sdc-elasticsearch - - try - ${project.basedir}/sdc-elasticsearch - - ${docker.tag} - ${docker.latest.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - + + + openecomp/sdc-elasticsearch + sdc-elasticsearch + + try + ${project.basedir}/sdc-elasticsearch + + ${docker.tag} + ${docker.latest.tag} + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + - - - openecomp/sdc-kibana - sdc-kibana - - try - ${project.basedir}/sdc-kibana - - ${docker.tag} - ${docker.latest.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - + + + openecomp/sdc-kibana + sdc-kibana + + try + ${project.basedir}/sdc-kibana + + ${docker.tag} + ${docker.latest.tag} + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + - - - openecomp/sdc-cassandra - sdc-cassandra - - try - ${project.basedir}/sdc-cassandra - - ${docker.tag} - ${docker.latest.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - + + + openecomp/sdc-cassandra + sdc-cassandra + + try + ${project.basedir}/sdc-cassandra + + ${docker.tag} + ${docker.latest.tag} + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + - - + + + openecomp/sdc-sanity + sdc-sanity + + try + ${project.basedir}/sdc-sanity + + ${docker.tag} + ${docker.latest.tag} + 1.1-STAGING-latest + + + - - - - + + + + clean-images pre-clean - remove + remove - true + true + openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-sanity - + - - generate-images - package - - build - - + + generate-images + package + + build + + - + push-images deploy - build - push + build + push - openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-cassandra + + openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-sanity - - - - - - - + + + + + + + diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh index c79dad2d56..d645f94b93 100755 --- a/sdc-os-chef/scripts/docker_run.sh +++ b/sdc-os-chef/scripts/docker_run.sh @@ -2,7 +2,7 @@ function usage { - echo "usage: docker_run.sh [ -r|--release ] [ -e|--environment ] [ -p|--port ] [ -l|--local ] [ -h|--help ]" + echo "usage: docker_run.sh [ -r|--release ] [ -e|--environment ] [ -p|--port ] [ -l|--local ] [ -s|--skipTests ] [ -h|--help ]" } @@ -25,6 +25,7 @@ function dir_perms { RELEASE=latest LOCAL=false +SKIPTESTS=false [ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__ [ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release [ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW @@ -48,6 +49,10 @@ while [ "$1" != "" ]; do shift LOCAL=true ;; + -s | --skipTests ) + shift + SKIPTESTS=true + ;; -h | --help ) usage exit @@ -157,3 +162,12 @@ if [ $? -ne 0 ]; then exit 1 fi +# sanityDocker +echo "docker run sdc-frontend..." +if [ ${SKIPTESTS} = false ]; then +echo "Triger sanity docker, please wait..." + if [ ${LOCAL} = false ]; then + docker pull ${PREFIX}/sdc-sanity:${RELEASE} + fi + docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 512m --memory-swap=512m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/sdc-sanity/target:/var/lib/tests/target --volume /data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume /data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} +fi diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb index c7f408f294..dac5853353 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb @@ -1 +1,2 @@ -normal['version'] = "1.1.0" +normal['version'] = + "1.1.0" diff --git a/sdc-os-chef/sdc-sanity/Dockerfile b/sdc-os-chef/sdc-sanity/Dockerfile index ea137b401b..38bf26641e 100644 --- a/sdc-os-chef/sdc-sanity/Dockerfile +++ b/sdc-os-chef/sdc-sanity/Dockerfile @@ -4,6 +4,13 @@ COPY chef-solo /root/chef-solo/ COPY chef-repo/cookbooks/. /root/chef-solo/cookbooks/ + +ENV TESTS_BASE /var/lib/tests +RUN mkdir -p "$TESTS_BASE" +WORKDIR $TESTS_BASE + +ADD test-apis-ci-*.jar ${TESTS_BASE}/ + COPY startup.sh /root/ RUN chmod 770 /root/startup.sh diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip new file mode 100644 index 0000000000..09eb9cd648 Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip differ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip new file mode 100644 index 0000000000..ab5163d9ed Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip differ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip new file mode 100644 index 0000000000..28c69a570f Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip differ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip new file mode 100644 index 0000000000..56de952150 Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip differ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip new file mode 100644 index 0000000000..7a14718c2c Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip differ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml new file mode 100644 index 0000000000..5d1a3e1537 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml @@ -0,0 +1,12 @@ +packages: + - org.openecomp.sdc.ci.tests.execute.general + - org.openecomp.sdc.ci.tests.execute.user + - org.openecomp.sdc.ci.tests.execute.property + - org.openecomp.sdc.ci.tests.execute.lifecycle + - org.openecomp.sdc.ci.tests.execute.resource + - org.openecomp.sdc.ci.tests.execute.service + - org.openecomp.sdc.ci.tests.execute.artifacts + - org.openecomp.sdc.ci.tests.execute.imports + - org.openecomp.sdc.ci.tests.execute.category + - org.openecomp.sdc.ci.tests.execute.distribution + - org.openecomp.sdc.ci.tests.execute.product \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml new file mode 100644 index 0000000000..ab37f7bee8 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml @@ -0,0 +1,48 @@ + designer: { + username: cs0008, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + admin: { + username: jh0003, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + ops: { + username: af0006, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + tester: { + username: kb0004, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + governor: { + username: ah0002, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + product_strategist: { + username: m99126, + password: 1910-FruitGum, + firstname: ASDC, + lastname: KASPIN + } + product_manager: { + username: m99127, + password: 747-Airplane, + firstname: ASDC, + lastname: KASPIN + } + product_local: { + username: pm0001, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties new file mode 100644 index 0000000000..d313e92b55 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties @@ -0,0 +1,34 @@ +# Define the root logger with appender file +log4j.rootLogger = INFO, FILE, stdout + +# Define the file appender +log4j.appender.FILE=org.apache.log4j.RollingFileAppender +log4j.appender.FILE.File=${targetlog}logs/ci-log.out + +# Define the layout for file appender +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n + +# Set the maximum file size before rollover +log4j.appender.FILE.maxFileSize=5MB + +# Set the the backup index +log4j.appender.FILE.maxBackupIndex=10 + + +############################################################# + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n + +log4j.logger.org.apache.cassandra.service.StorageProxy=INFO +log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout + +log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout +log4j.additivity.org.openecomp.sdc.ci.tests.utils=false + + diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh new file mode 100644 index 0000000000..933f9af6e4 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh @@ -0,0 +1,129 @@ +#!/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 ( ) [-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} +} + +#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/sdc.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}'` + + +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 $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 $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} + + + +echo "##################################################" +echo "################# status is ${status} #################" +echo "##################################################" + +exit $status \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb new file mode 100644 index 0000000000..0d9282b28a --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb @@ -0,0 +1,10 @@ +jetty_base="/var/lib/jetty" + + +cookbook_file "logback.xml" do + path "#{jetty_base}/config/sdc-simulator/logback.xml" + source "logback.xml" + owner "jetty" + group "jetty" + mode "0755" +end \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb new file mode 100644 index 0000000000..3bb482d89a --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb @@ -0,0 +1,16 @@ +jetty_base="/var/lib/jetty" + +directory "Jetty_etcdir_creation" do + path "/#{jetty_base}/etc" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +cookbook_file "/#{jetty_base}/etc/keystore" do + source "keystore" + owner "jetty" + group "jetty" + mode 0755 +end \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb new file mode 100644 index 0000000000..38b87fa65d --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb @@ -0,0 +1,14 @@ +jetty_base="/var/lib/jetty" +jetty_home="/usr/local/jetty" + +###### create Jetty modules +bash "create-jetty-modules" do +cwd "#{jetty_base}" +code <<-EOH + cd "#{jetty_base}" + java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy + java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +not_if "ls /#{jetty_base}/start.d/https.ini" +end + diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb new file mode 100644 index 0000000000..112cc4c2e7 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb @@ -0,0 +1,49 @@ +tests_base="/var/lib/tests" + + remote_directory '/var/lib/tests/testSuites' do + source 'testSuites' + owner 'root' + group 'root' + mode '0755' + action :create + end + + remote_directory '/var/lib/tests/Files' do + source 'Files' + owner 'root' + group 'root' + mode '0755' + action :create + end + + remote_directory '/var/lib/tests/conf' do + source 'conf' + owner 'root' + group 'root' + mode '0755' + action :create + end + + directory "create_target_dir" do + path "/var/lib/tests/target" + owner 'root' + group 'root' + mode '0755' + action :create + end + + directory "create_ExtentReport_dir" do + path "/var/lib/tests/ExtentReport" + owner 'root' + group 'root' + mode '0755' + action :create + end + + cookbook_file '/var/lib/tests/startTest.sh' do + source 'startTest.sh' + owner 'root' + group 'root' + mode '0755' + action :create + end \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb new file mode 100644 index 0000000000..cf6875746e --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb @@ -0,0 +1,43 @@ +tests_base="/var/lib/tests" + +template "sdc-yaml-config" do + path "#{tests_base}/conf/sdc.yaml" + source "sdc-sanity.yaml.erb" + owner "root" + group "root" + mode "0755" + variables ({ + :target_path => "#{tests_base}/target", + :catalogBE_ip => node['Nodes']['BE'], + :catalogBE_port => node['BE'][:http_port], + :webportal_ip => node['Nodes']['FE'], + :webportal_port => node['FE'][:http_port], + :titan_file => "#{tests_base}/conf/titan.properties", + :tests_base_ci => "#{tests_base}/CI/tests", + :components_path => "#{tests_base}/CI/components", + :importResourceConfigDir => "#{tests_base}/CI/importResource", + :importTypesDir => "#{tests_base}/CI/importTypesTest", + :importResourceTestsConfigDir => "#{tests_base}/CI/importResourceTests", + :ConfigurationFile => "#{tests_base}/conf/configuration.yaml", + :errorConfigurationFile => "#{tests_base}/conf/error-configuration.yaml", + :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_PWD => node['cassandra'][:cassandra_password], + :CASSANDRA_USR => node['cassandra'][:cassandra_user] + }) +end + +replication_factor=1 +template "titan.properties" do + path "/#{tests_base}/conf/titan.properties" + source "BE-titan.properties.erb" + owner "root" + group "root" + mode "0755" + variables({ + :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_PWD => node['cassandra'][:cassandra_password], + :CASSANDRA_USR => node['cassandra'][:cassandra_user], + :rep_factor => replication_factor, + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment + }) +end \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb new file mode 100644 index 0000000000..6f10a33dd6 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb @@ -0,0 +1,13 @@ +tests_base="/var/lib/tests" +ci_test_suite="onap.xml" + +bash "run asdc ci sanity tests" do +cwd "#{tests_base}" +code <<-EOH + cd "#{tests_base}" + jar_file=`ls test-apis*-jar-with-dependencies.jar` + ./startTest.sh $jar_file #{ci_test_suite} + echo "return code from startTest.sh = [$?]" +EOH +timeout 72000 +end \ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb index 27386d47ef..a42c7bf206 100644 --- a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb @@ -4,6 +4,7 @@ storage.port=9160 storage.username=<%= @CASSANDRA_USR %> storage.password=<%= @CASSANDRA_PWD %> storage.connection-timeout=10000 +storage.cassandra.keyspace=sdctitan storage.cassandra.ssl.enabled=false storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/.truststore diff --git a/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json b/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json new file mode 100644 index 0000000000..74f12c7cc6 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json @@ -0,0 +1,23 @@ +{ + "name": "sanityTests", + "description": "Execute sanity tests", + "json_class": "Chef::Role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "chef_type": "role", + "run_list": [ + "recipe[sdc-sanity::sanityTests_1_cleanup_jettydir]", + "recipe[sdc-sanity::sanityTests_2_setup_configuration]", + "recipe[sdc-sanity::sanityTests_3_sanity_execution]" +// "recipe[sdc-simulator::SDC_Simulator_3_logback]", +// "recipe[sdc-simulator::SDC_Simulator_4_locate_keystore]", +// "recipe[sdc-simulator::SDC_Simulator_5_create_jetty_modules]" + ], + "env_run_lists": { + } +} + diff --git a/sdc-os-chef/sdc-sanity/chef-solo/solo.json b/sdc-os-chef/sdc-sanity/chef-solo/solo.json index 5bd228127d..6487d4cc4e 100644 --- a/sdc-os-chef/sdc-sanity/chef-solo/solo.json +++ b/sdc-os-chef/sdc-sanity/chef-solo/solo.json @@ -1,4 +1,6 @@ { - "run_list": [ "recipe[sdc-sanity::setup_sanity]" ] + "run_list": [ + "role[sanityTests]" + ] } diff --git a/sdc-os-chef/sdc-sanity/startup.sh b/sdc-os-chef/sdc-sanity/startup.sh index 374a0e8c34..d4316c383f 100644 --- a/sdc-os-chef/sdc-sanity/startup.sh +++ b/sdc-os-chef/sdc-sanity/startup.sh @@ -6,13 +6,15 @@ chef-solo -c solo.rb -E ${CHEFNAME} rc=$? -if [[ $rc != 0 ]]; then - echo "Sanity failed !!!" - exit $rc -else - echo "completed successfully :-)" - exit 0 -fi +#if [[ $rc != 0 ]]; then +# echo "Sanity failed !!!" +# exit $rc +#else +# echo "completed successfully :-)" +# exit 0 +#fi -#/docker-entrypoint.sh +while true; do sleep 2; done + +##/docker-entrypoint.sh diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java index cfd132d5d0..ad1e8dd37d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java @@ -20,20 +20,13 @@ package org.openecomp.sdc.ci.tests.api; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import java.util.stream.Collectors; - +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; @@ -46,11 +39,7 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -59,26 +48,21 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.*; import org.slf4j.LoggerFactory; import org.testng.ITestContext; import org.testng.ITestResult; import org.testng.annotations.*; -import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.Status; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.*; +import java.util.function.Consumer; +import java.util.stream.Collectors; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.LoggerContext; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; public abstract class ComponentBaseTest { @@ -138,18 +122,22 @@ public abstract class ComponentBaseTest { @BeforeMethod(alwaysRun = true) public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { - - boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); - String className = method.getDeclaringClass().getName(); - if (emptyDataProvider && !className.contains("ToscaValidationTest") ) { - System.out.println("ExtentReport instance started from BeforeMethod..."); - String suiteName = ExtentManager.getSuiteName(context); + + String suiteName = ExtentManager.getSuiteName(context); ExtentTestManager.startTest(method.getName()); ExtentTestManager.assignCategory(this.getClass()); - - } else { - System.out.println("ExtentReport instance started from Test..."); - } + +// boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); +// String className = method.getDeclaringClass().getName(); +// if (emptyDataProvider) { +// System.out.println("ExtentReport instance started from BeforeMethod..."); +// String suiteName = ExtentManager.getSuiteName(context); +// ExtentTestManager.startTest(method.getName()); +// ExtentTestManager.assignCategory(this.getClass()); +// +// } else { +// System.out.println("ExtentReport instance started from Test..."); +// } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java index 2b341f5cbf..ec83b05be9 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java @@ -115,8 +115,8 @@ public class Onboard extends ComponentBaseTest { ExtentTestActions.log(Status.INFO, String.format("Certify Service")); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); - AtomicOperationUtils.distributeService(service, true); +// ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); +// AtomicOperationUtils.distributeService(service, true); ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java index 77be6df729..b82e6a0f52 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java @@ -284,7 +284,7 @@ public class FileHandling { public static void deleteDirectory(String directoryPath) { File dir = new File(directoryPath); try { - FileUtils.deleteDirectory(dir); + FileUtils.cleanDirectory(dir); } catch (IOException e) { System.out.println("Failed to delete " + dir); ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java index a1838b66d1..f6d3e58339 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java @@ -39,24 +39,16 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.ExtentTestActions; import org.openecomp.sdc.ci.tests.config.Config; - import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; - import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; - import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.testng.Assert; - import java.io.*; import java.nio.file.FileSystems; import java.util.*; -import java.util.stream.Collectors; import static org.testng.AssertJUnit.assertEquals; @@ -493,7 +485,7 @@ public class OnboardingUtils { jObject.put("description", "new VSP description"); jObject.put("category", "resourceNewCategory.generic"); jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("onboardingMethod", "HEAT"); + jObject.put("onboardingMethod", "NetworkPackage"); jObject.put("licensingVersion", jlicensingVersionObj); jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java index 22a352cbfe..39afff9022 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java @@ -372,7 +372,7 @@ public class LifecycleRestUtils extends BaseRestUtils { String userRemarks, DistributionStatusEnum reqDistributionStatus) throws Exception { String uniqueId = serviceDetails.getUniqueId(); Config config = Utils.getConfig(); - String environmentName = "PROD-Andreys-Only"; + String environmentName = "AUTO"; // String environmentName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0); DistributionStatusEnum distributionStatusEnum = DistributionStatusEnum.findState(reqDistributionStatus.getValue()); switch(distributionStatusEnum){ diff --git a/test-apis-ci/src/main/resources/ci/testSuites/onap.xml b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml new file mode 100644 index 0000000000..c075f10b11 --- /dev/null +++ b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file