aboutsummaryrefslogtreecommitdiffstats
path: root/csit/run-project-csit.sh
diff options
context:
space:
mode:
Diffstat (limited to 'csit/run-project-csit.sh')
-rwxr-xr-xcsit/run-project-csit.sh75
1 files changed, 41 insertions, 34 deletions
diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh
index 8c020b12..702c4020 100755
--- a/csit/run-project-csit.sh
+++ b/csit/run-project-csit.sh
@@ -27,17 +27,17 @@ function on_exit(){
rc=$?
if [[ ${WORKSPACE} ]]; then
if [[ ${WORKDIR} ]]; then
- rsync -av "$WORKDIR/" "$WORKSPACE/csit/archives/$TESTPLAN"
+ rsync -av "${WORKDIR}/" "${WORKSPACE}/csit/archives/${PROJECT}"
fi
# Record list of active docker containers
- docker ps --format "{{.Image}}" > "$WORKSPACE/csit/archives/$TESTPLAN/_docker-images.log"
+ docker ps --format "{{.Image}}" > "${WORKSPACE}/csit/archives/${PROJECT}/_docker-images.log"
# show memory consumption after all docker instances initialized
- docker_stats | tee "$WORKSPACE/csit/archives/$TESTPLAN/_sysinfo-2-after-robot.txt"
+ docker_stats | tee "${WORKSPACE}/csit/archives/${PROJECT}/_sysinfo-2-after-robot.txt"
fi
# Run teardown script plan if it exists
- cd "${TESTPLANDIR}/csit/plans/"
- TEARDOWN="${TESTPLANDIR}/csit/plans/teardown.sh"
+ cd "${TESTPLANDIR}/plans/"
+ TEARDOWN="${TESTPLANDIR}/plans/teardown.sh"
if [ -f "${TEARDOWN}" ]; then
echo "Running teardown script ${TEARDOWN}"
source_safely "${TEARDOWN}"
@@ -72,7 +72,7 @@ function docker_stats(){
# save current set options
function save_set() {
RUN_CSIT_SAVE_SET="$-"
- RUN_CSIT_SHELLOPTS="$SHELLOPTS"
+ RUN_CSIT_SHELLOPTS="${SHELLOPTS}"
}
# load the saved set options
@@ -80,10 +80,10 @@ function load_set() {
_setopts="$-"
# bash shellopts
- for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do
+ for i in $(echo "${SHELLOPTS}" | tr ':' ' ') ; do
set +o ${i}
done
- for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do
+ for i in $(echo "${RUN_CSIT_SHELLOPTS}" | tr ':' ' ') ; do
set -o ${i}
done
@@ -132,7 +132,7 @@ then
exit 1
fi
-if [ -z "$WORKSPACE" ]; then
+if [ -z "${WORKSPACE}" ]; then
export WORKSPACE=$(git rev-parse --show-toplevel)
fi
@@ -145,29 +145,36 @@ export ROBOT_VARIABLES=
source ${SCRIPTS}/get-branch-mariadb.sh
export PROJECT="${1}"
-rm -rf ${WORKSPACE}/${PROJECT}
-mkdir ${WORKSPACE}/${PROJECT}
+
cd ${WORKSPACE}
-# get the plan from git clone
-if ! `git clone -b ${GERRIT_BRANCH} --single-branch git://gerrit-mirror-ap.onap.org/mirror/policy/${PROJECT}.git` ; then
- echo "repo not found: policy/${PROJECT}"
- exit 1
-fi
+case "${PROJECT}" in
+xacml-pdp)
+ export TESTPLANDIR="${WORKSPACE}/csit/${PROJECT}"
+ ;;
+*)
+ export TESTPLANDIR="${WORKSPACE}/${PROJECT}/csit"
-if [ -f "${WORKSPACE}/${1}/csit/plans/testplan.txt" ]; then
- export TESTPLAN="${1}"
-else
- echo "testplan not found: ${WORKSPACE}/${1}/csit/plans/testplan.txt"
- exit 2
-fi
+ rm -rf ${WORKSPACE}/${PROJECT}
+ mkdir ${WORKSPACE}/${PROJECT}
-export TESTOPTIONS="${2}"
+ # get the plan from git clone
+ if ! `git clone -b ${GERRIT_BRANCH} --single-branch https://github.com/onap/policy-${PROJECT}.git ${PROJECT}` ; then
+ echo "repo not found: policy/${PROJECT}"
+ exit 1
+ fi
-rm -rf "$WORKSPACE/csit/archives/$TESTPLAN"
-mkdir -p "$WORKSPACE/csit/archives/$TESTPLAN"
+ if [ ! -f "${TESTPLANDIR}/plans/testplan.txt" ]; then
+ echo "testplan not found: ${TESTPLANDIR}/plans/testplan.txt"
+ exit 2
+ fi
+ ;;
+esac
-TESTPLANDIR="${WORKSPACE}/${TESTPLAN}"
+export TESTOPTIONS="${2}"
+
+rm -rf "${WORKSPACE}/csit/archives/${PROJECT}"
+mkdir -p "${WORKSPACE}/csit/archives/${PROJECT}"
# Run installation of prerequired libraries
source_safely "${SCRIPTS}/prepare-csit.sh"
@@ -182,29 +189,29 @@ cd "${WORKDIR}"
docker login -u docker -p docker nexus3.onap.org:10001
# Run setup script plan if it exists
-cd "${TESTPLANDIR}/csit/plans/"
-SETUP="${TESTPLANDIR}/csit/plans/setup.sh"
+cd "${TESTPLANDIR}/plans/"
+SETUP="${TESTPLANDIR}/plans/setup.sh"
if [ -f "${SETUP}" ]; then
echo "Running setup script ${SETUP}"
source_safely "${SETUP}"
fi
# show memory consumption after all docker instances initialized
-docker_stats | tee "$WORKSPACE/csit/archives/$TESTPLAN/_sysinfo-1-after-setup.txt"
+docker_stats | tee "${WORKSPACE}/csit/archives/${PROJECT}/_sysinfo-1-after-setup.txt"
# Run test plan
-cd "$WORKDIR"
+cd "${WORKDIR}"
echo "Reading the testplan:"
-cat "${TESTPLANDIR}/csit/plans/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${TESTPLANDIR}/csit/tests/|" > testplan.txt
+cat "${TESTPLANDIR}/plans/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${TESTPLANDIR}/tests/|" > testplan.txt
cat testplan.txt
SUITES=$( xargs -a testplan.txt )
echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
echo "Starting Robot test suites ${SUITES} ..."
relax_set
-python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${SUITES}
+python -m robot.run -N ${PROJECT} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${SUITES}
RESULT=$?
load_set
-echo "RESULT: $RESULT"
+echo "RESULT: ${RESULT}"
# Note that the final steps are done in on_exit function after this exit!
-exit $RESULT
+exit ${RESULT}