From e6d06622708fb269d0127e6f6ea8f856a29e3e35 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Tue, 12 Aug 2025 21:01:26 +0100 Subject: [PATCH] Add /instances endpoint test case Issue-ID: POLICY-5429 Change-Id: I5981555f9545f2f96a11b45af5c5b2d500ca3e03 Signed-off-by: adheli.tavares --- compose/compose.postgres.yml | 2 +- csit/resources/tests/policy-clamp-test.robot | 10 ++++++++++ csit/run-project-csit.sh | 13 +++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/compose/compose.postgres.yml b/compose/compose.postgres.yml index 50403236..bb497cdc 100644 --- a/compose/compose.postgres.yml +++ b/compose/compose.postgres.yml @@ -43,7 +43,7 @@ services: env_file: config/db-pg/db-pg.conf environment: POSTGRES_PASSWORD: policy_user - SQL_DB: policyadmin clampacm pooling operationshistory + SQL_DB: ${SCHEMAS_TO_BE_CREATED} SQL_HOST: postgres volumes: - ./config/db-migrator/init_pg.sh:/opt/app/policy/bin/db_migrator_policy_init_pg.sh:ro diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 0435022b..8940bcd8 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -98,6 +98,16 @@ SyncParticipant Wait Until Keyword Succeeds 1 min 10 sec VerifyCompositionParticipantSim 'InternalState' VerifyParticipantSim ${InstanceIdRestored} myParameterToUpdate +GetInstances + [Documentation] Get all the instances from the database + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/instances + Log Received response from ACM-R ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Length Should Be ${resp.json()["automationCompositionList"]} 1 + AcDeleteRestored2 [Documentation] Undeploy and delete of an automation composition restored. UndeployAndDeleteAutomationComposition ${compositionIdRestored} ${InstanceIdRestored} diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 2c018bb0..d91695de 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -95,11 +95,15 @@ function check_rest_endpoint() { fi } -function setup_clamp() { - export ACM_REPLICA_TEARDOWN=true +function export_clamp_variables() { export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" export TEST_ENV="docker" - export PROJECT=clamp + export PROJECT="clamp" + export SCHEMAS_TO_BE_CREATED="policyadmin clampacm" +} +function setup_clamp() { + export_clamp_variables + export ACM_REPLICA_TEARDOWN=true source "${DOCKER_COMPOSE_DIR}"/start-acm-replica.sh --start --replicas=2 --grafana echo "Waiting 2 minutes for the replicas to be started..." sleep 120 @@ -111,7 +115,7 @@ function setup_clamp() { } function setup_clamp_simple() { - export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" + export_clamp_variables source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-clamp-runtime-acm --grafana echo "Waiting 2 minutes acm-runtime and participants to start..." sleep 120 @@ -343,6 +347,7 @@ export DOCKER_COMPOSE_DIR="${WORKSPACE}/compose" export ROBOT_FILES="" export ACM_REPLICA_TEARDOWN=false export APEX_REPLICA_TEARDOWN=false +export SCHEMAS_TO_BE_CREATED="policyadmin operationshistory pooling" cd "${WORKSPACE}" || exit -- 2.16.6