Add /instances endpoint test case 85/141685/2
authoradheli.tavares <adheli.tavares@est.tech>
Tue, 12 Aug 2025 20:01:26 +0000 (21:01 +0100)
committeradheli.tavares <adheli.tavares@est.tech>
Wed, 13 Aug 2025 10:25:31 +0000 (11:25 +0100)
Issue-ID: POLICY-5429
Change-Id: I5981555f9545f2f96a11b45af5c5b2d500ca3e03
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
compose/compose.postgres.yml
csit/resources/tests/policy-clamp-test.robot
csit/run-project-csit.sh

index 5040323..bb497cd 100644 (file)
@@ -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
index 0435022..8940bcd 100644 (file)
@@ -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}
index 2c018bb..d91695d 100755 (executable)
@@ -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