diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-03-21 11:14:08 +0200 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-03-21 12:21:21 +0000 |
commit | f59a22539d5b372e2425c39963547985379d6990 (patch) | |
tree | fafd5663ab0e1a2b29049712b07717fcf6f8f509 /test-apis-ci/sdc-api-tests | |
parent | be00af7a2e0dc8dc2d5f8fbf03d778a8f632c4fb (diff) |
new ui sanity docker
Change-Id: I257c198c563771b5badcf36a479cb499f841682f
Issue-ID: SDC-995
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'test-apis-ci/sdc-api-tests')
50 files changed, 963 insertions, 0 deletions
diff --git a/test-apis-ci/sdc-api-tests/Dockerfile b/test-apis-ci/sdc-api-tests/Dockerfile new file mode 100644 index 0000000000..2be415080e --- /dev/null +++ b/test-apis-ci/sdc-api-tests/Dockerfile @@ -0,0 +1,18 @@ +FROM onap/base_sdc-sanity:1.2.0-SNAPSHOT-latest + +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 + +ENTRYPOINT [ "/root/startup.sh" ] diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/attributes/default.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/attributes/default.rb new file mode 100644 index 0000000000..4287ca8617 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/attributes/default.rb @@ -0,0 +1 @@ +#
\ No newline at end of file diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vHSS.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vHSS.csar Binary files differnew file mode 100644 index 0000000000..ea5c1283be --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vHSS.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vMME.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vMME.csar Binary files differnew file mode 100644 index 0000000000..f921f46e06 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vMME.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF.csar Binary files differnew file mode 100644 index 0000000000..6f997bcf98 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar Binary files differnew file mode 100644 index 0000000000..6f997bcf98 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW.csar Binary files differnew file mode 100644 index 0000000000..e7eed4b7c6 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW_fixed.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW_fixed.csar Binary files differnew file mode 100644 index 0000000000..fa83c17d20 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/Huawei_vSPGW_fixed.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcMmeVf.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcMmeVf.csar Binary files differnew file mode 100644 index 0000000000..bf0e775102 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcMmeVf.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar Binary files differnew file mode 100644 index 0000000000..0eacd74655 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf.csar Binary files differnew file mode 100644 index 0000000000..0eacd74655 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/ZteEpcSpgwVf.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vfw.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vfw.zip Binary files differnew file mode 100644 index 0000000000..b8273defea --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vfw.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vvg.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vvg.zip Binary files differnew file mode 100644 index 0000000000..dc9ef5d823 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/base_vvg.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si.csar Binary files differnew file mode 100644 index 0000000000..da19f0dd29 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si_fixed.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si_fixed.csar Binary files differnew file mode 100644 index 0000000000..bc8397a86e --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/cscf_si_fixed.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/infra.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/infra.zip Binary files differnew file mode 100644 index 0000000000..09eb9cd648 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/infra.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar Binary files differnew file mode 100644 index 0000000000..bf0e775102 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF.csar Binary files differnew file mode 100644 index 0000000000..347b8bcced --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_aligned.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_aligned.csar Binary files differnew file mode 100644 index 0000000000..347b8bcced --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_aligned.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_v3.0.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_v3.0.csar Binary files differnew file mode 100644 index 0000000000..094810a3f7 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vCSCF_v3.0.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vLB.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vLB.zip Binary files differnew file mode 100644 index 0000000000..b61ca1b83b --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vLB.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC.csar Binary files differnew file mode 100644 index 0000000000..ee60eed872 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC_aligned.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC_aligned.csar Binary files differnew file mode 100644 index 0000000000..ee60eed872 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vSBC_aligned.csar diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbng.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbng.zip Binary files differnew file mode 100644 index 0000000000..ab5163d9ed --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbng.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbrgemu.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbrgemu.zip Binary files differnew file mode 100644 index 0000000000..28c69a570f --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vbrgemu.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vfw.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vfw.zip Binary files differnew file mode 100644 index 0000000000..b8273defea --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vfw.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgmux.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgmux.zip Binary files differnew file mode 100644 index 0000000000..56de952150 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgmux.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgw.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgw.zip Binary files differnew file mode 100644 index 0000000000..7a14718c2c --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vgw.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vvg.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vvg.zip Binary files differnew file mode 100644 index 0000000000..dc9ef5d823 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs/vvg.zip diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/attsdc-packages.yaml b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/attsdc-packages.yaml new file mode 100644 index 0000000000..5d1a3e1537 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/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/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml new file mode 100644 index 0000000000..ab37f7bee8 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/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/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties new file mode 100644 index 0000000000..d313e92b55 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/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/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/logback.xml b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/logback.xml new file mode 100644 index 0000000000..b41ee12695 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/logback.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration scan="true" scanPeriod="5 seconds"> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n</pattern> + </encoder> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <file>logFile.log</file> + <append>true</append> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n</pattern> + </encoder> + </appender> + + <logger name="com.memorynotfound" level="INFO"/> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="FILE" /> + </root> + +</configuration>
\ No newline at end of file diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh new file mode 100644 index 0000000000..23a1d3fa95 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh @@ -0,0 +1,154 @@ +#!/bin/bash +REMOTE_DEBUG=false +RERUN=false +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} + 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}.*\</${PATTERN}$1\<\//1" ExtentReport/SDC_UI_Extent_Report.html + sed -i "${LINE_NUMBER_OF_TAKEN_REPORT_TIME}s/${PATTERN}.*\</${PATTERN}${TAKEN_TIME_IN_MINUTES} min\<\//1" ExtentReport/SDC_UI_Extent_Report.html +} + +#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_OPTIONS -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_OPTIONS -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 diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_1_setup_env.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_1_setup_env.rb new file mode 100644 index 0000000000..112cc4c2e7 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_1_setup_env.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/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb new file mode 100644 index 0000000000..cf6875746e --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_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/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_3_sanity_execution.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_3_sanity_execution.rb new file mode 100644 index 0000000000..4e6a5e19f6 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_3_sanity_execution.rb @@ -0,0 +1,19 @@ +tests_base="/var/lib/tests" +ci_test_suite="#{ENV['SUITE_NAME']}.xml" + +bash "echo status" do + code <<-EOH + echo "DOCKER STARTED" + EOH +end + +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} > #{tests_base}/target/startTest.log 2>&1 + echo "return code from startTest.sh = [$?]" + echo "DOCKER STARTED" +EOH +end diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-titan.properties.erb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-titan.properties.erb new file mode 100644 index 0000000000..a42c7bf206 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/BE-titan.properties.erb @@ -0,0 +1,25 @@ +storage.backend=cassandra +storage.hostname=<%= @CASSANDRA_IP %> +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 +storage.cassandra.ssl.truststore.password=Aa123456 + +cache.db-cache = false +cache.db-cache-clean-wait = 20 +cache.db-cache-time = 180000 +cache.db-cache-size = 0.5 + +storage.cassandra.read-consistency-level=LOCAL_QUORUM +storage.cassandra.write-consistency-level=LOCAL_QUORUM +storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.NetworkTopologyStrategy +storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,<%= @rep_factor %> +storage.cassandra.astyanax.local-datacenter=<%= @DC_NAME %> + +storage.lock.retries=5 +storage.lock.wait-time=500 diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb new file mode 100644 index 0000000000..8dde3cdefe --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/templates/default/sdc-sanity.yaml.erb @@ -0,0 +1,92 @@ +outputFolder: <%= @target_path %> +reportName: index.html +esHost: eshost +disributionClientHost: disClient +catalogFeHost: <%= @webportal_ip %> +catalogFePort: <%= @webportal_port %> +catalogBeHost: <%= @catalogBE_ip %> +catalogBePort: <%= @catalogBE_port %> +disributionClientPort: 8181 +esPort: 9200 + + +resourceConfigDir: <%= @tests_path_ci %> +componentsConfigDir: <%= @components_path %> +importResourceConfigDir: <%= @importResourceConfigDir %> +importResourceTestsConfigDir: <%= @importResourceTestsConfigDir %> +errorConfigurationFile: <%= @errorConfigurationFile %> +configurationFile: <%= @ConfigurationFile %> +importTypesConfigDir: <%= @importTypesDir %> +titanPropertiesFile: <%= @titan_file %> +systemUnderDebug: true + +cassandraHost: <%= @CASSANDRA_IP %> +cassandraAuthenticate: true +cassandraUsername: <%= @CASSANDRA_USR %> +cassandraPassword: <%= @CASSANDRA_PWD %> +cassandraSsl: false +cassandraTruststorePath : /tmp/.truststore +cassandraTruststorePassword : Aa123456 +cassandraAuditKeySpace: sdcAudit +cassandraArtifactKeySpace: sdcArtifact + +# catalog backend protocol +<% if node[:disableHttp] -%> +sdcHttpMethod: https +<% else %> +sdcHttpMethod: http +<% end -%> + +localDataCenter: DC-Automate01 + +stopOnClassFailure: false + +#List of non-abstract resources to keep during titan cleanup between tests +#Only 1.0 version will be kept +resourcesNotToDelete: + - Compute + - Database + - ObjectStorage + - BlockStorage + - LoadBalancer + - Port + - Network + - Root + - ContainerApplication + - ContainerRuntime + - DBMS + - SoftwareComponent + - WebApplication + - WebServer + - CinderVolume + - ContrailVirtualNetwork + - NeutronNet + - NeutronPort + - NovaServer + - AbstractSubstitute + - ContrailAbstractSubstitute + - ContrailCompute + - ContrailNetworkRules + - ContrailPort + - ContrailV2NetworkRules + - ContrailV2VirtualMachineInterface + - ContrailV2VirtualNetwork + - ContrailVirtualNetwork + - VL ELINE + - SecurityRules + - VL +#Resource categories to keep (including all their subcategories) +resourceCategoriesNotToDelete: + - Generic + - Network L2-3 + - Network L4+ + - Application L4+ + - Network Connectivity + - DcaeComponent + +#Service categories to keep +serviceCategoriesNotToDelete: + - Mobility + - Network L1-3 + - Network L4+ + - VoIP Call Control diff --git a/test-apis-ci/sdc-api-tests/chef-solo/LICENSE b/test-apis-ci/sdc-api-tests/chef-solo/LICENSE new file mode 100644 index 0000000000..11069edd79 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/test-apis-ci/sdc-api-tests/chef-solo/README.md b/test-apis-ci/sdc-api-tests/chef-solo/README.md new file mode 100644 index 0000000000..ddb0fda830 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/README.md @@ -0,0 +1,37 @@ +Deprecated +========== + +Use of this repository is deprecated. We recommend using the `chef generate repo` command that comes with [ChefDK](http://downloads.chef.io/chef-dk/). + +Overview +======== + +Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code. + +While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code. + +Repository Directories +====================== + +This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef. + +* `cookbooks/` - Cookbooks you download or create. +* `data_bags/` - Store data bags and items in .json in the repository. +* `roles/` - Store roles in .rb or .json in the repository. +* `environments/` - Store environments in .rb or .json in the repository. + +Configuration +============= + +The repository contains a knife configuration file. + +* .chef/knife.rb + +The knife configuration file `.chef/knife.rb` is a repository specific configuration file for knife. If you're using Hosted Chef, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation. + +https://docs.chef.io/knife.html + +Next Steps +========== + +Read the README file in each of the subdirectories for more information about what goes in those directories. diff --git a/test-apis-ci/sdc-api-tests/chef-solo/chefignore b/test-apis-ci/sdc-api-tests/chef-solo/chefignore new file mode 100644 index 0000000000..ba30af6cff --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/chefignore @@ -0,0 +1,11 @@ +# Put files/directories that should be ignored in this file. +# Lines that start with '# ' are comments. + +# emacs +*~ + +# vim +*.sw[a-z] + +# subversion +*/.svn/* diff --git a/test-apis-ci/sdc-api-tests/chef-solo/cookbooks/README.md b/test-apis-ci/sdc-api-tests/chef-solo/cookbooks/README.md new file mode 100644 index 0000000000..86ea46bfbb --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/cookbooks/README.md @@ -0,0 +1,54 @@ +This directory contains the cookbooks used to configure systems in your infrastructure with Chef. + +Knife needs to be configured to know where the cookbooks are located with the `cookbook_path` setting. If this is not set, then several cookbook operations will fail to work properly. + + cookbook_path ["./cookbooks"] + +This setting tells knife to look for the cookbooks directory in the present working directory. This means the knife cookbook subcommands need to be run in the `chef-repo` directory itself. To make sure that the cookbooks can be found elsewhere inside the repository, use an absolute path. This is a Ruby file, so something like the following can be used: + + current_dir = File.dirname(__FILE__) + cookbook_path ["#{current_dir}/../cookbooks"] + +Which will set `current_dir` to the location of the knife.rb file itself (e.g. `~/chef-repo/.chef/knife.rb`). + +Configure knife to use your preferred copyright holder, email contact and license. Add the following lines to `.chef/knife.rb`. + + cookbook_copyright "Example, Com." + cookbook_email "cookbooks@example.com" + cookbook_license "apachev2" + +Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3", or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the the comments in those files. + +Create new cookbooks in this directory with Knife. + + knife cookbook create COOKBOOK + +This will create all the cookbook directory components. You don't need to use them all, and can delete the ones you don't need. It also creates a README file, metadata.rb and default recipe. + +You can also download cookbooks directly from the Opscode Cookbook Site. There are two subcommands to help with this depending on what your preference is. + +The first and recommended method is to use a vendor branch if you're using Git. This is automatically handled with Knife. + + knife cookbook site install COOKBOOK + +This will: + +* Download the cookbook tarball from cookbooks.opscode.com. +* Ensure its on the git master branch. +* Checks for an existing vendor branch, and creates if it doesn't. +* Checks out the vendor branch (chef-vendor-COOKBOOK). +* Removes the existing (old) version. +* Untars the cookbook tarball it downloaded in the first step. +* Adds the cookbook files to the git index and commits. +* Creates a tag for the version downloaded. +* Checks out the master branch again. +* Merges the cookbook into master. +* Repeats the above for all the cookbooks dependencies, downloading them from the community site + +The last step will ensure that any local changes or modifications you have made to the cookbook are preserved, so you can keep your changes through upstream updates. + +If you're not using Git, use the site download subcommand to download the tarball. + + knife cookbook site download COOKBOOK + +This creates the COOKBOOK.tar.gz from in the current directory (e.g., `~/chef-repo`). We recommend following a workflow similar to the above for your version control tool. diff --git a/test-apis-ci/sdc-api-tests/chef-solo/data_bags/README.md b/test-apis-ci/sdc-api-tests/chef-solo/data_bags/README.md new file mode 100644 index 0000000000..0c15a391fa --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/data_bags/README.md @@ -0,0 +1,63 @@ +Data Bags +--------- + +This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag. + +First, create a directory for the data bag. + + mkdir data_bags/BAG + +Then create the JSON files for items that will go into that bag. + + $EDITOR data_bags/BAG/ITEM.json + +The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM". For example, + + { + "id": "foo" + } + +Next, create the data bag on the Chef Server. + + knife data bag create BAG + +Then upload the items in the data bag's directory to the Chef Server. + + knife data bag from file BAG ITEM.json + + +Encrypted Data Bags +------------------- + +Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key. + + openssl rand -base64 512 > secret_key + +You may use this secret_key to add items to a data bag during a create. + + knife data bag create --secret-file secret_key passwords mysql + +You may also use it when adding ITEMs from files, + + knife data bag create passwords + knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key + +The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example, + + { + "id": "mysql", + "password": "abc123" + } + +Without the secret_key, the contents are encrypted. + + knife data bag show passwords mysql + id: mysql + password: 2I0XUUve1TXEojEyeGsjhw== + +Use the secret_key to view the contents. + + knife data bag show passwords mysql --secret-file secret_key + id: mysql + password: abc123 + diff --git a/test-apis-ci/sdc-api-tests/chef-solo/environments/README.md b/test-apis-ci/sdc-api-tests/chef-solo/environments/README.md new file mode 100644 index 0000000000..50ac48db2b --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/environments/README.md @@ -0,0 +1,5 @@ +Requires Chef 0.10.0+. + +This directory is for Ruby DSL and JSON files for environments. For more information see the Chef wiki page: + +http://docs.chef.io/environments.html diff --git a/test-apis-ci/sdc-api-tests/chef-solo/roles/README.md b/test-apis-ci/sdc-api-tests/chef-solo/roles/README.md new file mode 100644 index 0000000000..b0ee0b4d21 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/roles/README.md @@ -0,0 +1,16 @@ +Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife. + +For example, create `roles/base_example.rb`: + + name "base_example" + description "Example base role applied to all nodes." + # List of recipes and roles to apply. Requires Chef 0.8, earlier versions use 'recipes()'. + #run_list() + # Attributes applied if the node doesn't have it set already. + #default_attributes() + # Attributes applied no matter what the node has set already. + #override_attributes() + +Then upload it to the Chef Server: + + knife role from file roles/base_example.rb diff --git a/test-apis-ci/sdc-api-tests/chef-solo/roles/sanityApiTests.json b/test-apis-ci/sdc-api-tests/chef-solo/roles/sanityApiTests.json new file mode 100644 index 0000000000..1f2b4605ce --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/roles/sanityApiTests.json @@ -0,0 +1,20 @@ +{ + "name": "sanityApiTests", + "description": "Execute sanity api tests", + "json_class": "Chef::Role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "chef_type": "role", + "run_list": [ + "recipe[sdc-api-tests::sanityApiTests_1_setup_env]", + "recipe[sdc-api-tests::sanityApiTests_2_setup_configuration]", + "recipe[sdc-api-tests::sanityApiTests_3_sanity_execution]" + ], + "env_run_lists": { + } +} + diff --git a/test-apis-ci/sdc-api-tests/chef-solo/solo.json b/test-apis-ci/sdc-api-tests/chef-solo/solo.json new file mode 100644 index 0000000000..cca880430a --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/solo.json @@ -0,0 +1,6 @@ +{ + "run_list": [ + "role[sanityApiTests]" + ] +} + diff --git a/test-apis-ci/sdc-api-tests/chef-solo/solo.rb b/test-apis-ci/sdc-api-tests/chef-solo/solo.rb new file mode 100644 index 0000000000..06c1af4592 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-solo/solo.rb @@ -0,0 +1,16 @@ +root = File.absolute_path(File.dirname(__FILE__)) +file_cache_path root +cookbook_path root + '/cookbooks' +json_attribs root + '/solo.json' +checksum_path root + '/checksums' +data_bag_path root + '/data_bags' +environment_path root + '/environments' +file_backup_path root + '/backup' +file_cache_path root + '/cache' +log_level :info +log_location STDOUT +rest_timeout 300 +role_path root + '/roles' +syntax_check_cache_path +umask 0022 +verbose_logging nil diff --git a/test-apis-ci/sdc-api-tests/startup.sh b/test-apis-ci/sdc-api-tests/startup.sh new file mode 100644 index 0000000000..349741c353 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/startup.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cd /root/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} + +rc=$? + +if [[ $rc != 0 ]]; then + echo "Sanity failed !!!" + exit $rc +else + echo "completed successfully :-)" + exit 0 +fi
\ No newline at end of file |