Improve stability in integration tests 21/137721/1
authorFrancescoFioraEst <francesco.fiora@est.tech>
Fri, 19 Apr 2024 09:16:40 +0000 (10:16 +0100)
committerFrancesco Fiora <francesco.fiora@est.tech>
Fri, 19 Apr 2024 09:45:50 +0000 (09:45 +0000)
Issue-ID: POLICY-4964
Change-Id: I0ca1ff2fdfb02a9c39d4b860333f5aebc959d650
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
csit/resources/tests/policy-clamp-test.robot
csit/run-k8s-csit.sh

index 123249a..95af26a 100644 (file)
@@ -7,7 +7,7 @@ Library     json
 Library     yaml
 
 *** Test Cases ***
-Healthcheck
+HealthcheckAcm
      [Documentation]    Healthcheck on Clamp Acm
      ${auth}=    Create List    runtimeUser    zb!XztG34
      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
@@ -17,6 +17,23 @@ Healthcheck
      Log    Received response from ACM healthcheck {resp.text}
      Should Be Equal As Strings    ${resp.status_code}     200
 
+HealthcheckApi
+     [Documentation]    Healthcheck on policy-api
+     Wait Until Keyword Succeeds    5 min    10 sec    VerifyHealthcheckApi
+
+HealthcheckPap
+     [Documentation]    Healthcheck on policy-pap
+     Wait Until Keyword Succeeds    5 min    10 sec    VerifyHealthcheckPap
+
+RegisterParticipants
+     [Documentation]  Register Participants.
+     ${auth}=    Create List    runtimeUser    zb!XztG34
+     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
+     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
+     ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/participants
+     Log    Received response from runtime acm ${resp.text}
+     Should Be Equal As Strings    ${resp.status_code}     202
+
 CommissionAutomationComposition
      [Documentation]  Commission automation composition.
      ${auth}=    Create List    runtimeUser    zb!XztG34
@@ -30,15 +47,6 @@ CommissionAutomationComposition
      set Suite variable  ${compositionId}  ${respyaml["compositionId"]}
      Should Be Equal As Strings    ${resp.status_code}     201
 
-RegisterParticipants
-     [Documentation]  Register Participants.
-     ${auth}=    Create List    runtimeUser    zb!XztG34
-     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
-     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
-     ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/participants
-     Log    Received response from runtime acm ${resp.text}
-     Should Be Equal As Strings    ${resp.status_code}     202
-
 PrimeACDefinitions
      [Documentation]  Prime automation composition definition
      ${auth}=    Create List    runtimeUser    zb!XztG34
@@ -99,7 +107,7 @@ QueryPolicyTypes
      [Documentation]    Verify the new policy types created
      ${auth}=    Create List    policyadmin    zb!XztG34
      Sleep  10s
-     Log    Creating session http://${POLICY_API_IP}}:6969
+     Log    Creating session http://${POLICY_API_IP}:6969
      ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
      ${resp}=   GET On Session     policy  /policy/api/v1/policytypes     headers=${headers}
@@ -159,6 +167,26 @@ DeleteACDefinition
 
 *** Keywords ***
 
+VerifyHealthcheckApi
+     [Documentation]    Verify Healthcheck on policy-api
+     ${auth}=    Create List    policyadmin    zb!XztG34
+     Log    Creating session http://${POLICY_API_IP}
+     ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   GET On Session     policy  /policy/api/v1/health     headers=${headers}
+     Log    Received response from policy-api healthcheck ${resp.text}
+     Should Be Equal As Strings    ${resp.status_code}   200
+
+VerifyHealthcheckPap
+     [Documentation]    Verify Healthcheck on policy-pap
+     ${auth}=    Create List    policyadmin    zb!XztG34
+     Log    Creating session http://${POLICY_PAP_IP}
+     ${session}=    Create Session      policy  http://${POLICY_PAP_IP}   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   GET On Session     policy  /policy/pap/v1/health     headers=${headers}
+     Log    Received response from policy-pap healthcheck ${resp.text}
+     Should Be Equal As Strings    ${resp.status_code}     200
+
 VerifyPriming
     [Arguments]  ${primestate}
     [Documentation]    Verify the AC definitions are primed to the participants
index 04f0a83..478d048 100755 (executable)
@@ -175,7 +175,7 @@ function print_robot_log() {
     robotpod=$(sudo microk8s kubectl get po | grep policy-csit)
     podName=$(echo "$robotpod" | awk '{print $1}')
     echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..."
-    sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=10m pod/"$podName"
+    sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName"
     echo "Policy deployment status:"
     sudo microk8s kubectl get po
     sudo microk8s kubectl get all -A