diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-10-31 16:01:59 +0000 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2024-11-13 13:50:32 +0000 |
commit | 21c3a2bfe23cbcf007def49e51191c40b98fa978 (patch) | |
tree | 4a493e6438cc7831cb692b68dd78ecb0c664b7c4 /csit/run-project-csit.sh | |
parent | 79ccac3162d05b4797450836c669e81465d3fa2d (diff) |
Fix issues with grafana dashboards after multiple micrometer
and spring actuator uplifts.
- changed the metrics that have been renamed automatically
- changed the irate functions range to the same used on each
dashboard instead of fixed
- apex_healthcheck function wasn't being called when running
csit script because it was declared after usage
Issue-ID: POLICY-5155
Change-Id: I993f022937f6e2041a6c50dc5037c559da087849
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'csit/run-project-csit.sh')
-rwxr-xr-x | csit/run-project-csit.sh | 121 |
1 files changed, 67 insertions, 54 deletions
diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 8183cdee..e355d5ff 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -18,6 +18,23 @@ # limitations under the License. # +# even with forced finish, clean up docker containers +function on_exit(){ + rm -rf ${CSAR_DIR}/csar_temp.csar + + # teardown of compose containers for acm-replicas doesn't work with normal stop-compose script + if [ "${ACM_REPLICA_TEARDOWN}" = true ]; then + source ${DOCKER_COMPOSE_DIR}/start-acm-replica.sh --stop --replicas=2 + elif [ "${APEX_REPLICA_TEARDOWN}" = true ]; then + source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --stop --replicas=2 + else + source ${DOCKER_COMPOSE_DIR}/stop-compose.sh ${PROJECT} + fi + + mv ${DOCKER_COMPOSE_DIR}/*.log ${ROBOT_LOG_DIR} + exit $RC +} + function docker_stats(){ # General memory details if [ "$(uname -s)" == "Darwin" ] @@ -40,11 +57,41 @@ function docker_stats(){ echo } +function apex_healthcheck() { + sleep 20 + + healthy=false + + while [ $healthy = false ] + do + msg=`curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:${APEX_PORT}/policy/apex-pdp/v1/healthcheck` + echo "${msg}" | grep -q true + if [ "${?}" -eq 0 ] + then + healthy=true + break + fi + sleep 10s + done + + if [ $healthy = false ]; then + exit 2 + fi +} + +function check_rest_endpoint() { + bash ${SCRIPTS}/wait_for_rest.sh localhost "${1}" + rc=$? + if [ $rc -ne 0 ]; then + on_exit + fi +} + function setup_clamp() { export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh policy-clamp-runtime-acm --grafana sleep 30 - bash ${SCRIPTS}/wait_for_rest.sh localhost "${ACM_PORT}" + check_rest_endpoint "${ACM_PORT}" } function setup_clamp_replica() { @@ -56,31 +103,32 @@ function setup_clamp_replica() { echo "Waiting a minute for the replicas to be started..." sleep 60 # checking on apex-pdp status because acm-r replicas only start after apex-pdp is running - bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck - bash ${SCRIPTS}/wait_for_rest.sh localhost ${ACM_PORT} + check_rest_endpoint ${ACM_PORT} } function setup_api() { export ROBOT_FILES="api-test.robot api-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh api --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${API_PORT} + check_rest_endpoint ${API_PORT} } function setup_pap() { export ROBOT_FILES="pap-test.robot pap-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh apex-pdp --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} + check_rest_endpoint ${PAP_PORT} } function setup_apex() { export ROBOT_FILES="apex-pdp-test.robot apex-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh apex-pdp --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} - bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } @@ -89,8 +137,8 @@ function setup_apex_medium() { export APEX_REPLICA_TEARDOWN=true source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --start --replicas=3 sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} - bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } @@ -99,52 +147,34 @@ function setup_apex_large() { export APEX_REPLICA_TEARDOWN=true source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --start --replicas=10 sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} - bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} + check_rest_endpoint ${PAP_PORT} + check_rest_endpoint ${APEX_PORT} apex_healthcheck } -function apex_healthcheck() { - sleep 20 - - healthy=false - - while [ $healthy = false ] - do - msg=`curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:${APEX_PORT}/policy/apex-pdp/v1/healthcheck` - echo "${msg}" | grep -q true - if [ "${?}" -eq 0 ] - then - healthy=true - break - fi - sleep 10s - done -} - function setup_drools_apps() { export ROBOT_FILES="drools-applications-test.robot drools-applications-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} + check_rest_endpoint ${PAP_PORT} sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_PORT} + check_rest_endpoint ${DROOLS_APPS_PORT} sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT} + check_rest_endpoint ${DROOLS_APPS_TELEMETRY_PORT} } function setup_xacml_pdp() { export ROBOT_FILES="xacml-pdp-test.robot xacml-pdp-slas.robot" source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost "${XACML_PORT}" + check_rest_endpoint "${XACML_PORT}" } function setup_drools_pdp() { export ROBOT_FILES="drools-pdp-test.robot" - source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-pdp + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-pdp --grafana sleep 30 - bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_TELEMETRY_PORT} + check_rest_endpoint ${DROOLS_TELEMETRY_PORT} } function setup_distribution() { @@ -155,9 +185,9 @@ function setup_distribution() { sudo mkdir /tmp/distribution export ROBOT_FILES="distribution-test.robot" - source ${DOCKER_COMPOSE_DIR}/start-compose.sh distribution + source ${DOCKER_COMPOSE_DIR}/start-compose.sh distribution --grafana sleep 10 - bash ${SCRIPTS}/wait_for_rest.sh localhost "${DIST_PORT}" + check_rest_endpoint "${DIST_PORT}" } function build_robot_image() { @@ -229,23 +259,6 @@ function set_project_config() { esac } -# even with forced finish, clean up docker containers -function on_exit(){ - rm -rf ${CSAR_DIR}/csar_temp.csar - - # teardown of compose containers for acm-replicas doesn't work with normal stop-compose script - if [ "${ACM_REPLICA_TEARDOWN}" = true ]; then - source ${DOCKER_COMPOSE_DIR}/start-acm-replica.sh --stop --replicas=2 - elif [ "${APEX_REPLICA_TEARDOWN}" = true ]; then - source ${DOCKER_COMPOSE_DIR}/start-multiple-pdp.sh --stop --replicas=2 - else - source ${DOCKER_COMPOSE_DIR}/stop-compose.sh ${PROJECT} - fi - - mv ${DOCKER_COMPOSE_DIR}/*.log ${ROBOT_LOG_DIR} - exit $RC -} - # ensure that teardown and other finalizing steps are always executed trap on_exit EXIT |