diff options
author | 2023-02-09 11:56:27 +0000 | |
---|---|---|
committer | 2023-02-14 15:52:04 +0000 | |
commit | 9fc9fa480d5b18b0988b9388d13db8328032fc52 (patch) | |
tree | 4d851a64d6593335e7c02a5267875833a04e9591 /csit/common-library.robot | |
parent | f5a11b0b346df610ffa8d9857956abf113ce6765 (diff) |
Add SLAs validations to docker csit robot tests
Issue-ID: POLICY-4529
Change-Id: I197a51892e9135d20c2e8a49ce7787df3bfbd4fa
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'csit/common-library.robot')
-rw-r--r-- | csit/common-library.robot | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/csit/common-library.robot b/csit/common-library.robot index e8a9640c..871e7efe 100644 --- a/csit/common-library.robot +++ b/csit/common-library.robot @@ -120,7 +120,18 @@ GetMetrics Log Received response from policy ${resp.text} [return] ${resp} -QueryPrometheus ${query} - ${resp}= GET http://localhost:30259/api/v1/query?query=${query} expected_status=200 - Log Received response from policy ${resp.text} - [return] ${resp} +QueryPrometheus + [Arguments] ${query} + ${params}= Create Dictionary query=${query} + ${resp}= GET http://localhost:30259/api/v1/query ${params} + Status Should Be OK + Log Received response from Prometheus ${resp.text} + [return] ${resp.json()} + +ValidateResponseTime + [Arguments] ${job} ${uri} ${method} ${timeLimit} + [Documentation] Check if uri response is under the required time + ${resp}= QueryPrometheus http_server_requests_seconds_sum{uri="${uri}",method="${method}",job="${job}"}/http_server_requests_seconds_count{uri="${uri}",method="${method}",job="${job}"} + ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} + ${actualTime}= Set Variable ${rawNumber * ${1000}} + Should Be True ${actualTime} <= ${timeLimit} |