summaryrefslogtreecommitdiffstats
path: root/csit/resources/tests/pap-slas.robot
blob: 1fa1962794c6b2b78fbb4296ef8fc5d329ad67d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
*** Settings ***
Library    Collections
Library    RequestsLibrary
Library    OperatingSystem
Library    json
Resource    ${CURDIR}/common-library.robot

*** Keywords ***
ValidateResponseTimeForPap
    [Arguments]  ${uri}  ${method}
    [Documentation]  Check if uri response is under the 500ms required time for pap metrics
    ValidateResponseTime  pap-metrics  ${uri}  ${method}  500

*** Test Cases ***
WaitForPrometheusServer
    [Documentation]  Wait for Prometheus server to gather all metrics
    Sleep    1 minute

ValidateResponseTimeForHealthcheck
    [Documentation]  Validate component healthcheck response time
    ValidateResponseTimeForPap  /healthcheck  GET

ValidateResponseTimeForSystemHealthcheck
    [Documentation]  Validate if system healthcheck response time is under 1000ms
    ValidateResponseTime  pap-metrics  /components/healthcheck  GET  10000

ValidateResponseTimeForStatistics
    [Documentation]  Validate statistics response time
    ValidateResponseTimeForPap  /statistics  GET

# TODO: includes notification, so always over 500ms
# ValidateResponseTimeCreateGroup
#     [Documentation]  Validate create group response time
#     ValidateResponseTimeForPap  /pdps/groups/batch  POST

ValidateResponseTimeQueryPolicyAudit
    [Documentation]  Validate query audits response time
    ValidateResponseTimeForPap  /policies/audit  GET

ValidateResponseTimeUpdateGroup
    [Documentation]  Validate pdps/group response time
    ValidateResponseTimeForPap  /pdps/groups/{name}  PUT

ValidatePolicyDeploymentTime
    [Documentation]  Check if deployment of policy is under 2000ms
    ${resp}=  QueryPrometheus  pap_policy_deployments_seconds_sum{operation="deploy",status="SUCCESS"}/pap_policy_deployments_seconds_count{operation="deploy",status="SUCCESS"}
    ${rawNumber}=  Evaluate  ${resp['data']['result'][0]['value'][1]}
    ${actualTime}=   Set Variable  ${rawNumber * ${1000}}
    Should Be True   ${actualTime} <= ${2000}

ValidateResponseTimeDeletePolicy
    [Documentation]  Check if undeployment of policy is under 2000ms
    ${resp}=  QueryPrometheus  pap_policy_deployments_seconds_sum{operation="undeploy",status="SUCCESS"}/pap_policy_deployments_seconds_count{operation="undeploy",status="SUCCESS"}
    ${rawNumber}=  Evaluate  ${resp['data']['result'][0]['value'][1]}
    ${actualTime}=   Set Variable  ${rawNumber * ${1000}}
    Should Be True   ${actualTime} <= ${2000}

ValidateResponseTimeDeleteGroup
    [Documentation]  Validate delete group response time
    ValidateResponseTimeForPap  /pdps/groups/{name}  DELETE