Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 6 | Resource ${CURDIR}/common-library.robot |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 7 | |
| 8 | *** Test Cases *** |
| 9 | |
| 10 | Healthcheck |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 11 | [Documentation] Verify policy distribution health check |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 12 | ${hcauth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 13 | ${resp}= PerformGetRequest ${DISTRIBUTION_IP} /healthcheck 200 null ${hcauth} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 14 | Should Be Equal As Strings ${resp.json()['code']} 200 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 15 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 16 | InvokeDistributionAndRunEventOnEngine |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 17 | Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 18 | |
Ram Krishna Verma | 1792373 | 2022-01-24 16:53:04 -0500 | [diff] [blame] | 19 | MetricsAfterExecution |
| 20 | [Documentation] Verify policy-distribution is exporting prometheus metrics after execution |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 21 | ${hcauth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 22 | ${resp}= PerformGetRequest ${DISTRIBUTION_IP} /metrics 200 null ${hcauth} |
adheli.tavares | 80e382e | 2024-05-01 14:08:35 +0100 | [diff] [blame] | 23 | Should Contain ${resp.text} total_distribution_received_count_total 1.0 |
| 24 | Should Contain ${resp.text} distribution_success_count_total 1.0 |
Ram Krishna Verma | 1792373 | 2022-01-24 16:53:04 -0500 | [diff] [blame] | 25 | Should Contain ${resp.text} distribution_failure_count_total 0.0 |
adheli.tavares | 80e382e | 2024-05-01 14:08:35 +0100 | [diff] [blame] | 26 | Should Contain ${resp.text} total_download_received_count_total 1.0 |
| 27 | Should Contain ${resp.text} download_success_count_total 1.0 |
Ram Krishna Verma | 1792373 | 2022-01-24 16:53:04 -0500 | [diff] [blame] | 28 | Should Contain ${resp.text} download_failure_count_total 0.0 |
| 29 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 30 | *** Keywords *** |
| 31 | |
| 32 | InvokeDistributionUsingFile And RunEventOnApexEngine |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 33 | 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 Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 35 | Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP" |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 36 | Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 |
| 37 | ${data}= Get Binary File ${CURDIR}/data/event.json |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 38 | &{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.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 40 | Remove Files ${CURDIR}/data/temp/sample_csar_with_apex_policy.csar |
| 41 | Remove Files ${CURDIR}/data/csar/csar_temp.csar |