aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2020-03-23 15:40:55 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-23 15:40:55 +0000
commitbc1a21cf53f0c6653eb31c953256fc5322877481 (patch)
tree63e032b6e5ad1823c26945609fd5d4c85e3e81db
parent7405933ba6de25b33ca577e714f298b9fe82beee (diff)
parentff18aa2acdb898ff8b48b5733ed761ed1a376929 (diff)
Merge "Finalize CSIT script regardless of setup success"
-rwxr-xr-xrun-csit.sh42
-rw-r--r--tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot2
2 files changed, 25 insertions, 19 deletions
diff --git a/run-csit.sh b/run-csit.sh
index 2c45812d..634b0c7c 100755
--- a/run-csit.sh
+++ b/run-csit.sh
@@ -22,6 +22,29 @@
# functions
#
+function on_exit(){
+ rc=$?
+ rsync -av "$WORKDIR/" "$WORKSPACE/archives"
+
+ # Record list of active docker containers
+ docker ps --format "{{.Image}}" > "$WORKSPACE/archives/_docker-images.log"
+
+ # show memory consumption after all docker instances initialized
+ docker_stats | tee "$WORKSPACE/archives/_sysinfo-2-after-robot.txt"
+
+ # Run teardown script plan if it exists
+ cd "${TESTPLANDIR}"
+ TEARDOWN="${TESTPLANDIR}/teardown.sh"
+ if [ -f "${TEARDOWN}" ]; then
+ echo "Running teardown script ${TEARDOWN}"
+ source_safely "${TEARDOWN}"
+ fi
+ # TODO: do something with the output
+ exit $rc
+}
+# ensure that teardown and other finalizing steps are always executed
+trap on_exit EXIT
+
function docker_stats(){
#General memory details
echo "> top -bn1 | head -3"
@@ -166,22 +189,5 @@ python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOP
RESULT=$?
load_set
echo "RESULT: $RESULT"
-rsync -av "$WORKDIR/" "$WORKSPACE/archives"
-
-# Record list of active docker containers
-docker ps --format "{{.Image}}" > "$WORKSPACE/archives/_docker-images.log"
-
-# show memory consumption after all docker instances initialized
-docker_stats | tee "$WORKSPACE/archives/_sysinfo-2-after-robot.txt"
-
-# Run teardown script plan if it exists
-cd "${TESTPLANDIR}"
-TEARDOWN="${TESTPLANDIR}/teardown.sh"
-if [ -f "${TEARDOWN}" ]; then
- echo "Running teardown script ${TEARDOWN}"
- source_safely "${TEARDOWN}"
-fi
-
-# TODO: do something with the output
-
+# Note that the final steps are done in on_exit function after this exit!
exit $RESULT
diff --git a/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot b/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot
index 1941e357..49e4faa7 100644
--- a/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot
+++ b/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot
@@ -3,7 +3,7 @@ Resource sdc_interface.robot
Resource sdc_dcaed_interface.robot
*** Test Cases ***
-# This test case implements the steps described in
+# For now, this test case implements the steps described in
# https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC
Create Service With Monitoring Configuration Test
[Tags] sdc-dcae-d