blob: b8b49248dd2cad3a23d9ee34fd7f8623e43609bb [file] [log] [blame]
Jim Hahnb3a962f2021-05-12 11:33:43 -04001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
adheli.tavares1f339f82023-02-17 15:14:07 +00006Resource ${CURDIR}/common-library.robot
Jim Hahnb3a962f2021-05-12 11:33:43 -04007
8*** Test Cases ***
9
10Healthcheck
adheli.tavares496b3012021-11-01 10:40:32 +000011 [Documentation] Verify policy distribution health check
adheli.tavares1153b6d2023-02-28 12:59:37 +000012 ${hcauth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000013 ${resp}= PerformGetRequest ${DISTRIBUTION_IP} /healthcheck 200 null ${hcauth}
adheli.tavares496b3012021-11-01 10:40:32 +000014 Should Be Equal As Strings ${resp.json()['code']} 200
Jim Hahnb3a962f2021-05-12 11:33:43 -040015
Jim Hahnb3a962f2021-05-12 11:33:43 -040016InvokeDistributionAndRunEventOnEngine
adheli.tavares496b3012021-11-01 10:40:32 +000017 Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
Jim Hahnb3a962f2021-05-12 11:33:43 -040018
Ram Krishna Verma17923732022-01-24 16:53:04 -050019MetricsAfterExecution
20 [Documentation] Verify policy-distribution is exporting prometheus metrics after execution
adheli.tavares1153b6d2023-02-28 12:59:37 +000021 ${hcauth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000022 ${resp}= PerformGetRequest ${DISTRIBUTION_IP} /metrics 200 null ${hcauth}
adheli.tavares80e382e2024-05-01 14:08:35 +010023 Should Contain ${resp.text} total_distribution_received_count_total 1.0
24 Should Contain ${resp.text} distribution_success_count_total 1.0
Ram Krishna Verma17923732022-01-24 16:53:04 -050025 Should Contain ${resp.text} distribution_failure_count_total 0.0
adheli.tavares80e382e2024-05-01 14:08:35 +010026 Should Contain ${resp.text} total_download_received_count_total 1.0
27 Should Contain ${resp.text} download_success_count_total 1.0
Ram Krishna Verma17923732022-01-24 16:53:04 -050028 Should Contain ${resp.text} download_failure_count_total 0.0
29
Jim Hahnb3a962f2021-05-12 11:33:43 -040030*** Keywords ***
31
32InvokeDistributionUsingFile And RunEventOnApexEngine
adheli.tavares1f339f82023-02-17 15:14:07 +000033 Copy File ${CURDIR}/data/csar/csar_temp.csar ${CURDIR}/data/csar/temp.csar
34 Move File ${CURDIR}/data/csar/temp.csar ${TEMP_FOLDER}/sample_csar_with_apex_policy.csar
Jim Hahnb3a962f2021-05-12 11:33:43 -040035 Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP"
adheli.tavares1f339f82023-02-17 15:14:07 +000036 Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1
37 ${data}= Get Binary File ${CURDIR}/data/event.json
Jim Hahnb3a962f2021-05-12 11:33:43 -040038 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
39 ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} expected_status=200
adheli.tavares1f339f82023-02-17 15:14:07 +000040 Remove Files ${CURDIR}/data/temp/sample_csar_with_apex_policy.csar
41 Remove Files ${CURDIR}/data/csar/csar_temp.csar