diff options
author | Yuli Shlosberg <ys9693@att.com> | 2017-09-12 14:11:48 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-09-20 13:22:07 +0300 |
commit | 9dde926417f80d93f4159be8164ed5b3d8790a75 (patch) | |
tree | 0df8a81a29b85c66c1e18dbedf8bf5b66526bf8c /sdc-os-chef/sdc-sanity/chef-repo | |
parent | 0ad3c80822671529393e551bbb7b4a69dbd8550e (diff) |
Build sanity docker execute automation
Change-Id: Iab282ea167d12fba4a3f425a5d300397ab435b44
Issue-Id: SDC-315
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/sdc-sanity/chef-repo')
16 files changed, 369 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000000..09eb9cd648 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip 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 Binary files differnew file mode 100644 index 0000000000..ab5163d9ed --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip 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 Binary files differnew file mode 100644 index 0000000000..28c69a570f --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip 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 Binary files differnew file mode 100644 index 0000000000..56de952150 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip 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 Binary files differnew file mode 100644 index 0000000000..7a14718c2c --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip 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 (<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/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 |