-
Notifications
You must be signed in to change notification settings - Fork 1
/
performance.robot
46 lines (40 loc) · 1.52 KB
/
performance.robot
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
*** Settings ***
Library SSHLibrary
Library String
Resource resource.robot
Force Tags perf
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${EXPECTED_AVG_TIME} 35.00
${EXPECTED_MAX_TIME} 40.00
${PERF_TEST_TIME} 10s
@{SYSBENCH_CMD} sysbench
... --num-threads=4
... --test=cpu
... --max-time=${PERF_TEST_TIME}
... run
*** Test cases ***
Test CPU Performance
[Timeout] 30s
Run Sysbench
Per request average should be less than expected
Per request maximum should be less than expected
*** Keywords ***
Run Sysbench
${cmd} = Catenate @{SYSBENCH_CMD}
${PERF_RESULTS} = Execute Command ${cmd}
Log ${PERF_RESULTS} console=yes
Set Test Variable ${PERF_RESULTS}
Per request average should be less than expected
${avg} = Get Per Request Val ${PERF_RESULTS} avg:
Should Be True ${avg} < ${EXPECTED_AVG_TIME}
Per request maximum should be less than expected
${max} = Get Per Request Val ${PERF_RESULTS} max:
Should Be True ${max} < ${EXPECTED_MAX_TIME}
Get Per Request Val
[Arguments] ${test_results} ${val_type}
${str} = Get Lines Containing String ${test_results} ${val_type}
${str} = Get Regexp Matches ${str} ([\\d\\.]*)ms 1
${val} = Convert To Number ${str[0]}
[Return] ${val}