From d802fd9a6c6aaffa330a30b68f7896ffebaa4fcd Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 15 Aug 2024 12:39:19 +0100 Subject: Change default database to PostgreSQL Issue-ID: POLICY-5118 Change-Id: I22ece93aca3cbc5e406e4942ce5255a7b7b60761 Signed-off-by: adheli.tavares --- csit/resources/scripts/wait_for_rest.sh | 2 +- .../resources/tests/drools-applications-test.robot | 7 +- csit/run-acm-regression.sh | 13 ++- csit/run-project-csit.sh | 124 ++++++++++----------- 4 files changed, 73 insertions(+), 73 deletions(-) (limited to 'csit') diff --git a/csit/resources/scripts/wait_for_rest.sh b/csit/resources/scripts/wait_for_rest.sh index e400bbd4..ce47d600 100755 --- a/csit/resources/scripts/wait_for_rest.sh +++ b/csit/resources/scripts/wait_for_rest.sh @@ -54,7 +54,7 @@ do do if command -v docker > /dev/null 2>&1 then - docker ps --format "table {{ .Names }}\t{{ .Status }}" + docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" fi curl "http://$host:$port" > /dev/null 2>&1 rc=$? diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot index 3c4303ad..8b0a3694 100644 --- a/csit/resources/tests/drools-applications-test.robot +++ b/csit/resources/tests/drools-applications-test.robot @@ -69,10 +69,9 @@ DeployDroolsPolicies [Documentation] Deploys the Policies to Drools DeployPolicy deploy.drools.policies.json Sleep 5s - ${result}= CheckKafkaTopic policy-notification operational.modifyconfig - Should Contain ${result} deployed-policies - Should Contain ${result} operational.scaleout - Should Contain ${result} operational.restart + @{otherMessages}= Create List deployed-policies operational.scaleout operational.restart + AssertMessageFromTopic policy-notification operational.modifyconfig ${otherMessages} + #VcpeExecute # [Documentation] Executes VCPE Policy diff --git a/csit/run-acm-regression.sh b/csit/run-acm-regression.sh index 2c91bcb4..19160027 100755 --- a/csit/run-acm-regression.sh +++ b/csit/run-acm-regression.sh @@ -67,10 +67,6 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -if [ -z "$ROBOT_LOG_DIR" ]; then - export ROBOT_LOG_DIR=/tmp/ -fi - export SCRIPTS="${WORKSPACE}/csit/resources/scripts" COMPOSE_FOLDER="${WORKSPACE}"/compose REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/ @@ -128,7 +124,9 @@ cd ${COMPOSE_FOLDER} docker login -u docker -p docker nexus3.onap.org:10001 > /dev/null 2>&1 source export-ports.sh > /dev/null 2>&1 -docker compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" +export CONTAINER_LOCATION="nexus3.onap.org:10001/" + +docker compose up -d "policy-clamp-runtime-acm" # wait for the app to start up "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" @@ -138,3 +136,8 @@ cd ${REGRESSION_FOLDER} # Invoke the regression test cases mvn clean test -Dtests.skip=false +cd ${COMPOSE_FOLDER} +source stop-compose.sh clamp +mv ${COMPOSE_FOLDER}/*.log ${REGRESSION_FOLDER} + +cd ${REGRESSION_FOLDER} diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index cbb62e6d..409209fd 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -33,7 +33,7 @@ function docker_stats(){ fi # Memory details per Docker - docker ps --format "table {{ .Names }}\t{{ .Status }}" + docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" echo docker stats --no-stream @@ -42,66 +42,65 @@ function docker_stats(){ function setup_clamp() { export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh policy-clamp-runtime-acm --grafana + source ${DOCKER_COMPOSE_DIR}/start-compose.sh policy-clamp-runtime-acm --grafana sleep 30 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" + bash ${SCRIPTS}/wait_for_rest.sh localhost "${ACM_PORT}" } function setup_clamp_replica() { + export ACM_REPLICA_TEARDOWN=true export ROBOT_FILES="policy-clamp-test.robot" export TEST_ENV="docker" - source "${WORKSPACE}"/compose/start-acm-replica.sh 2 - sleep 30 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" + export PROJECT=clamp + source ${DOCKER_COMPOSE_DIR}/start-acm-replica.sh --start --replicas=2 + 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} + apex_healthcheck + bash ${SCRIPTS}/wait_for_rest.sh localhost ${ACM_PORT} } function setup_api() { export ROBOT_FILES="api-test.robot api-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh api --grafana + source ${DOCKER_COMPOSE_DIR}/start-compose.sh api --grafana sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${API_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${API_PORT} } function setup_pap() { export ROBOT_FILES="pap-test.robot pap-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh apex-pdp --grafana + 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 ${PAP_PORT} } function setup_apex() { export ROBOT_FILES="apex-pdp-test.robot apex-slas.robot" - source "${WORKSPACE}"/compose/start-compose.sh apex-pdp --grafana + 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} - apex_healthcheck -} - -function setup_apex_postgres() { - export ROBOT_FILES="apex-pdp-test.robot" - source "${WORKSPACE}"/compose/start-postgres-tests.sh apex-pdp 1 - sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} apex_healthcheck } function setup_apex_medium() { export SUITES="apex-slas-3.robot" - source "${WORKSPACE}"/compose/start-multiple-pdp.sh 3 + 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} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} apex_healthcheck } function setup_apex_large() { export ROBOT_FILES="apex-slas-10.robot" - source "${WORKSPACE}"/compose/start-multiple-pdp.sh 10 + 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} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${APEX_PORT} apex_healthcheck } @@ -125,57 +124,49 @@ function apex_healthcheck() { function setup_drools_apps() { export ROBOT_FILES="drools-applications-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh drools-applications + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_PORT} sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_APPS_TELEMETRY_PORT} } function setup_xacml_pdp() { export ROBOT_FILES="xacml-pdp-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh xacml-pdp + source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}" -} - -function setup_xacml_pdp_postgres() { - export ROBOT_FILES="xacml-pdp-test.robot" - source "${WORKSPACE}"/compose/start-postgres-tests.sh xacml-pdp 1 - sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}" + bash ${SCRIPTS}/wait_for_rest.sh localhost "${XACML_PORT}" } function setup_drools_pdp() { export ROBOT_FILES="drools-pdp-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh drools-pdp + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-pdp sleep 30 - bash "${SCRIPTS}"/wait_for_rest.sh localhost ${DROOLS_TELEMETRY_PORT} + bash ${SCRIPTS}/wait_for_rest.sh localhost ${DROOLS_TELEMETRY_PORT} } function setup_distribution() { - zip -F ${WORKSPACE}/csit/resources/tests/data/csar/sample_csar_with_apex_policy.csar \ - --out ${WORKSPACE}/csit/resources/tests/data/csar/csar_temp.csar -q + zip -F ${CSAR_DIR}/sample_csar_with_apex_policy.csar --out ${CSAR_DIR}/csar_temp.csar -q # Remake temp directory sudo rm -rf /tmp/distribution sudo mkdir /tmp/distribution export ROBOT_FILES="distribution-test.robot" - source "${WORKSPACE}"/compose/start-compose.sh distribution + source ${DOCKER_COMPOSE_DIR}/start-compose.sh distribution sleep 10 - bash "${SCRIPTS}"/wait_for_rest.sh localhost "${DIST_PORT}" + bash ${SCRIPTS}/wait_for_rest.sh localhost "${DIST_PORT}" } function build_robot_image() { - bash "${SCRIPTS}"/build-csit-docker-image.sh + bash ${SCRIPTS}/build-csit-docker-image.sh cd ${WORKSPACE} } function run_robot() { - docker compose -f "${WORKSPACE}"/compose/docker-compose.yml up csit-tests + docker compose -f ${DOCKER_COMPOSE_DIR}/compose.yaml up csit-tests export RC=$? } @@ -204,7 +195,7 @@ function set_project_config() { ;; apex-pdp-postgres | policy-apex-pdp-postgres) - setup_apex_postgres + setup_apex ;; apex-pdp-medium | policy-apex-pdp-medium) @@ -219,10 +210,6 @@ function set_project_config() { setup_xacml_pdp ;; - xacml-pdp-postgres | policy-xacml-pdp-postgres) - setup_xacml_pdp_postgres - ;; - drools-pdp | policy-drools-pdp) setup_drools_pdp ;; @@ -244,9 +231,18 @@ function set_project_config() { # even with forced finish, clean up docker containers function on_exit(){ - rm -rf ${WORKSPACE}/csit/resources/tests/data/csar/csar_temp.csar - source ${WORKSPACE}/compose/stop-compose.sh - cp ${WORKSPACE}/compose/*.log ${WORKSPACE}/csit/archives/${PROJECT} + 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 } @@ -261,11 +257,13 @@ fi export GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview) export PROJECT="${1}" -export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT} +export ROBOT_LOG_DIR="${WORKSPACE}/csit/archives/${PROJECT}" export SCRIPTS="${WORKSPACE}/csit/resources/scripts" +export CSAR_DIR="${WORKSPACE}/csit/resources/tests/data/csar" +export DOCKER_COMPOSE_DIR="${WORKSPACE}/compose" export ROBOT_FILES="" -# always 'docker' if running docker compose -export TEST_ENV="docker" +export ACM_REPLICA_TEARDOWN=false +export APEX_REPLICA_TEARDOWN=false cd "${WORKSPACE}" @@ -284,7 +282,7 @@ if [[ $compose_version == *"Docker Compose version"* ]]; then else echo "Docker Compose Plugin not installed. Installing now..." sudo mkdir -p /usr/local/lib/docker/cli-plugins - sudo curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose + sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose fi @@ -301,9 +299,9 @@ else build_robot_image fi -docker_stats | tee "${WORKSPACE}/csit/archives/${PROJECT}/_sysinfo-1-after-setup.txt" +docker_stats | tee "${ROBOT_LOG_DIR}/_sysinfo-1-after-setup.txt" # start the CSIT container and run the tests run_robot -docker ps --format "table {{ .Names }}\t{{ .Status }}" +docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}" -- cgit 1.2.3-korg