diff options
author | Liam Fallon <liam.fallon@est.tech> | 2023-03-01 09:36:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2023-03-01 09:36:34 +0000 |
commit | 0800c95d2398b6b53517184c2e5f46546274f558 (patch) | |
tree | 0d221ed699554650df99370a487b4ccd420bc139 | |
parent | 0fee57e58feab329b31f6a60e8b64dfc269f2bee (diff) | |
parent | 36806ac304bac477a463b7eb9f8d3fb664c8b4e3 (diff) |
Merge "Add SLA validations to API"
-rwxr-xr-x | csit/resources/scripts/setup-api.sh | 3 | ||||
-rw-r--r-- | csit/resources/tests/api-slas.robot | 45 | ||||
-rw-r--r-- | csit/resources/tests/api-test.robot | 5 |
3 files changed, 52 insertions, 1 deletions
diff --git a/csit/resources/scripts/setup-api.sh b/csit/resources/scripts/setup-api.sh index 2a984643..5a5cad20 100755 --- a/csit/resources/scripts/setup-api.sh +++ b/csit/resources/scripts/setup-api.sh @@ -28,7 +28,8 @@ unset http_proxy https_proxy # wait for the app to start up bash "${SCRIPTS}"/wait_for_rest.sh localhost ${API_PORT} -export SUITES="api-test.robot" +export SUITES="api-test.robot +api-slas.robot" ROBOT_VARIABLES="-v POLICY_API_IP:localhost:${API_PORT} -v PROMETHEUS_IP:localhost:${PROMETHEUS_PORT} -v DATA:${DATA} -v NODETEMPLATES:${NODETEMPLATES}" diff --git a/csit/resources/tests/api-slas.robot b/csit/resources/tests/api-slas.robot new file mode 100644 index 00000000..c5feb728 --- /dev/null +++ b/csit/resources/tests/api-slas.robot @@ -0,0 +1,45 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Resource ${CURDIR}/common-library.robot + +*** Keywords *** +ValidateResponseTimeForApi + [Arguments] ${uri} ${method} + [Documentation] Check if uri response is under the 500ms required time for api metrics + ValidateResponseTime api-metrics ${uri} ${method} 500 + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidateResponseTimeForHealthcheck + [Documentation] Validate component healthcheck response time + ValidateResponseTimeForApi /healthcheck GET + +ValidateResponseTimeForStatistics + [Documentation] Validate statistics response time + ValidateResponseTimeForApi /statistics GET + +ValidateResponseTimeQueryPolicies + [Documentation] Validate query policies response time + ValidateResponseTimeForApi /policies GET + +ValidateResponseTimeQueryPolicyVersion + [Documentation] Validate query policy by version response time + ValidateResponseTimeForApi /policies/{policyId}/versions/{policyVersion} GET + +ValidateResponseTimeCreatePolicy + [Documentation] Validate response time for creating a policy + ValidateResponseTimeForApi /policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies POST + +ValidateResponseTimeCreatePolicyType + [Documentation] Validate response time for creating a policyType + ValidateResponseTimeForApi /policytypes POST + +ValidateResponseTimeDeletePolicy + [Documentation] Validate response time for deletion of policies + ValidateResponseTimeForApi /policies/{policyId}/versions/{policyVersion} DELETE
\ No newline at end of file diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot index e8679a7f..f3c87de3 100644 --- a/csit/resources/tests/api-test.robot +++ b/csit/resources/tests/api-test.robot @@ -140,6 +140,11 @@ GetReq ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} [return] ${resp} +ValidateResponseTimeForApi + [Arguments] ${url} ${method} + [Documentation] Check if url response is under required time for api metrics + ValidateResponseTime api-metrics ${url} ${method} 500 + DeleteReq [Arguments] ${url} ${expectedstatus} ${auth}= PolicyAdminAuth |