From a2d8b3bf42f2ea4f82790e0c86d2ce744657310c Mon Sep 17 00:00:00 2001 From: Yuli Shlosberg Date: Mon, 25 Dec 2017 16:35:04 +0200 Subject: Add branch support for sdc csit Change-Id: I45e28013113123abd28e5d42ded1a2c7a64b0f8b Issue-ID: SDC-761 Signed-off-by: Yuli Shlosberg --- test/csit/plans/sdc/nightly/setup.sh | 8 +--- test/csit/plans/sdc/sanity/setup.sh | 7 ---- test/csit/scripts/sdc/clone_and_setup_sdc_data.sh | 49 ++++++++++++++++++++++ test/csit/scripts/sdc/docker_health.sh | 8 ++-- .../sdc/kill_containers_and_remove_dataFolders.sh | 8 ++++ test/csit/scripts/sdc/start_sdc_containers.sh | 4 +- test/csit/tests/sdc/nightly/test1.robot | 2 +- test/csit/tests/sdc/sanity/test1.robot | 2 +- 8 files changed, 66 insertions(+), 22 deletions(-) diff --git a/test/csit/plans/sdc/nightly/setup.sh b/test/csit/plans/sdc/nightly/setup.sh index ac7a7f3f4..5abdd6bd1 100644 --- a/test/csit/plans/sdc/nightly/setup.sh +++ b/test/csit/plans/sdc/nightly/setup.sh @@ -16,7 +16,7 @@ # # Modifications copyright (c) 2017 AT&T Intellectual Property # -# Place the scripts in run order: +## Place the scripts in run order: mkdir ${WORKSPACE}/archives @@ -24,12 +24,6 @@ chmod -R 777 ${WORKSPACE}/archives source ${WORKSPACE}/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh -source ${WORKSPACE}/test/csit/scripts/sdc/start_sdc_containers.sh - -source ${WORKSPACE}/test/csit/scripts/sdc/docker_health.sh - -source ${WORKSPACE}/test/csit/scripts/sdc/start_sdc_sanity.sh - BE_IP=`get-instance-ip.sh sdc-BE` echo BE_IP=${BE_IP} diff --git a/test/csit/plans/sdc/sanity/setup.sh b/test/csit/plans/sdc/sanity/setup.sh index 3e4e66024..de3cb942c 100644 --- a/test/csit/plans/sdc/sanity/setup.sh +++ b/test/csit/plans/sdc/sanity/setup.sh @@ -21,13 +21,6 @@ source ${WORKSPACE}/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh -source ${WORKSPACE}/test/csit/scripts/sdc/start_sdc_containers.sh - -source ${WORKSPACE}/test/csit/scripts/sdc/docker_health.sh - -source ${WORKSPACE}/test/csit/scripts/sdc/start_sdc_sanity.sh - - BE_IP=`get-instance-ip.sh sdc-BE` echo BE_IP=${BE_IP} diff --git a/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh b/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh index 5dbfb5fc2..1025f405d 100644 --- a/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh +++ b/test/csit/scripts/sdc/clone_and_setup_sdc_data.sh @@ -1,4 +1,7 @@ #!/bin/bash + + +set -x # # ============LICENSE_START======================================================= # ONAP CLAMP @@ -61,4 +64,50 @@ export HOST_IP=$IP_ADDRESS sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" ${WORKSPACE}/data/environments/$ENV_NAME.json sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" ${WORKSPACE}/data/environments/$ENV_NAME.json + +source ${WORKSPACE}/data/clone/sdc/version.properties +export RELEASE=$major.$minor-STAGING-latest +export DEP_ENV=$ENV_NAME + +cp ${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh ${WORKSPACE}/test/csit/scripts/sdc/ +#sed -i "s~/data~${WORKSPACE}\/data~g" ${WORKSPACE}/test/csit/scripts/sdc/docker_run.sh +#sed -i "s/HOST_IP=\${IP}/HOST_IP=\${HOST_IP}/g" ${WORKSPACE}/test/csit/scripts/sdc/docker_run.sh +sed -i "s/ENVNAME=\"\${DEP_ENV}\"/ENVNAME=\"\${ENV_NAME}\"/g" ${WORKSPACE}/test/csit/scripts/sdc/docker_run.sh + +source ${WORKSPACE}/data/clone/sdc/version.properties +export RELEASE=$major.$minor-STAGING-latest + + +bash -x ${WORKSPACE}/test/csit/scripts/sdc/docker_run.sh -r ${RELEASE} -p 10001 -t + +sleep 120 + +#monitor sanity process + +TIME_OUT=1200 +INTERVAL=20 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + +PID=`docker exec -i sdc-sanity ps -ef | grep java | awk '{print $2}'` +echo sanity PID is -- $PID + +if [ -z "$PID" ] + then + echo SDC sanity finished in $TIME seconds + break + fi + + echo Sleep: $INTERVAL seconds before testing if SDC sanity completed. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ] + then + echo TIME OUT: Sany was NOT completed in $TIME_OUT seconds... Could cause problems for tests... +fi + + + diff --git a/test/csit/scripts/sdc/docker_health.sh b/test/csit/scripts/sdc/docker_health.sh index 832b25a23..4264b1a59 100644 --- a/test/csit/scripts/sdc/docker_health.sh +++ b/test/csit/scripts/sdc/docker_health.sh @@ -13,11 +13,11 @@ curl http://localhost:8181/sdc1/rest/healthCheck echo "" echo "" -res=`curl -s -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" "http://localhost:8080/sdc2/rest/v1/user/demo" | wc -l` -if [[ ${res} != 0 ]] +http_code=$(curl -o out.html -w '%{http_code}' -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" http://localhost:8080/sdc2/rest/v1/user/demo;) +if [[ ${http_code} != 200 ]] then - echo "Error [${res}] while user existance check" - exit ${res} + echo "Error [${http_code}] while user existance check" + return ${http_code} fi echo "check user existance: OK" diff --git a/test/csit/scripts/sdc/kill_containers_and_remove_dataFolders.sh b/test/csit/scripts/sdc/kill_containers_and_remove_dataFolders.sh index 48a31e895..efa372ed2 100644 --- a/test/csit/scripts/sdc/kill_containers_and_remove_dataFolders.sh +++ b/test/csit/scripts/sdc/kill_containers_and_remove_dataFolders.sh @@ -19,6 +19,14 @@ echo "This is ${WORKSPACE}/test/csit/scripts/sdc/kill_and_remove_dataFolder.sh" +# copy logs to archive + +cp -rf ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport/* ${WORKSPACE}/archives/ +cp -rf ${WORKSPACE}/data/logs/ ${WORKSPACE}/archives/ +cp -rf ${WORKSPACE}/data/logs/sdc-sanity/target/*.xml ${WORKSPACE}/archives/ + +ls -Rt ${WORKSPACE}/archives/ + #kill and remove all sdc dockers docker stop $(docker ps -a -q --filter="name=sdc") docker rm $(docker ps -a -q --filter="name=sdc") diff --git a/test/csit/scripts/sdc/start_sdc_containers.sh b/test/csit/scripts/sdc/start_sdc_containers.sh index 0dd373256..5bc8770bf 100644 --- a/test/csit/scripts/sdc/start_sdc_containers.sh +++ b/test/csit/scripts/sdc/start_sdc_containers.sh @@ -24,8 +24,8 @@ echo "This is ${WORKSPACE}/test/csit/scripts/sdc/start_sdc_containers.sh" - -export RELEASE='1.1-STAGING-latest' +source ${WORKSPACE}/data/clone/sdc/version.properties +export RELEASE=$major.$minor-STAGING-latest export 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 diff --git a/test/csit/tests/sdc/nightly/test1.robot b/test/csit/tests/sdc/nightly/test1.robot index 6d4dc242d..3783e159e 100644 --- a/test/csit/tests/sdc/nightly/test1.robot +++ b/test/csit/tests/sdc/nightly/test1.robot @@ -10,7 +10,7 @@ Get Requests health check ok CreateSession sdc-be http://localhost:8080 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request sdc-be /sdc2/rest/healthCheck headers=&{headers} - Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.status_code} 500 @{ITEMS}= Copy List ${resp.json()['componentsInfo']} : FOR ${ELEMENT} IN @{ITEMS} \ Log ${ELEMENT['healthCheckComponent']} ${ELEMENT['healthCheckStatus']} diff --git a/test/csit/tests/sdc/sanity/test1.robot b/test/csit/tests/sdc/sanity/test1.robot index 6d4dc242d..3783e159e 100644 --- a/test/csit/tests/sdc/sanity/test1.robot +++ b/test/csit/tests/sdc/sanity/test1.robot @@ -10,7 +10,7 @@ Get Requests health check ok CreateSession sdc-be http://localhost:8080 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request sdc-be /sdc2/rest/healthCheck headers=&{headers} - Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.status_code} 500 @{ITEMS}= Copy List ${resp.json()['componentsInfo']} : FOR ${ELEMENT} IN @{ITEMS} \ Log ${ELEMENT['healthCheckComponent']} ${ELEMENT['healthCheckStatus']} -- cgit 1.2.3-korg