Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Test Cases *** |
a.sreekumar | df7d47f | 2019-08-29 13:24:04 +0000 | [diff] [blame] | 8 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 9 | Healthcheck |
| 10 | [Documentation] Runs Policy Distribution Health check |
a.sreekumar | df7d47f | 2019-08-29 13:24:04 +0000 | [diff] [blame] | 11 | ${auth}= Create List healthcheck zb!XztG34 |
ramverma | d6e2139 | 2019-02-11 14:52:47 +0000 | [diff] [blame] | 12 | Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969 |
| 13 | ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 14 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 15 | ${resp}= Get Request policy /healthcheck headers=${headers} |
| 16 | Log Received response from policy ${resp.text} |
| 17 | Should Be Equal As Strings ${resp.status_code} 200 |
| 18 | Should Be Equal As Strings ${resp.json()['code']} 200 |
a.sreekumar | df7d47f | 2019-08-29 13:24:04 +0000 | [diff] [blame] | 19 | |
Bilal A | a86c81d | 2019-03-13 13:32:24 +0000 | [diff] [blame] | 20 | Statistics |
| 21 | [Documentation] Runs Policy Distribution Statistics |
a.sreekumar | df7d47f | 2019-08-29 13:24:04 +0000 | [diff] [blame] | 22 | ${auth}= Create List healthcheck zb!XztG34 |
Bilal A | a86c81d | 2019-03-13 13:32:24 +0000 | [diff] [blame] | 23 | Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969 |
| 24 | ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth} |
| 25 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 26 | ${resp}= Get Request policy /statistics headers=${headers} |
| 27 | Log Received response from policy ${resp.text} |
| 28 | Should Be Equal As Strings ${resp.status_code} 200 |
| 29 | Should Be Equal As Strings ${resp.json()['code']} 200 |
a.sreekumar | df7d47f | 2019-08-29 13:24:04 +0000 | [diff] [blame] | 30 | |
| 31 | InvokeDistributionAndRunEventOnEngine |
| 32 | Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine |
| 33 | |
| 34 | *** Keywords *** |
| 35 | |
| 36 | InvokeDistributionUsingFile And RunEventOnApexEngine |
| 37 | Copy File ${SCRIPT_DIR}/config/distribution/csar/csar_temp.csar ${SCRIPT_DIR}/config/distribution/csar/temp.csar |
| 38 | Move File ${SCRIPT_DIR}/config/distribution/csar/temp.csar ${SCRIPT_DIR}/config/distribution/temp/sample_csar_with_apex_policy.csar |
| 39 | Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP" |
| 40 | Create Session apexSession http://${APEX_IP}:23324 max_retries=1 |
| 41 | ${data}= Get Binary File ${CURDIR}${/}data${/}event.json |
| 42 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 43 | ${resp}= Put Request apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} |
| 44 | Should Be Equal As Strings ${resp.status_code} 200 |
| 45 | Remove Files ${SCRIPT_DIR}/config/distribution/temp/sample_csar_with_apex_policy.csar |