diff options
author | Andrejs Verza <andrejs.verza@zabbix.com> | 2021-05-08 19:04:37 +0300 |
---|---|---|
committer | Andrejs Verza <andrejs.verza@zabbix.com> | 2021-05-08 19:04:37 +0300 |
commit | 692ce9e77be2d0b9c4466bc3b37d2009cf9cc9f4 (patch) | |
tree | 6e0a257af74b21d1d6705c5bbf954b8a90f0a164 /tests | |
parent | 683ec581c1cdfd58ce47d109c80143477a9d6e49 (diff) | |
parent | 7e35f9722b2a2535a23b2b92f8fc836ae396539b (diff) |
A.F.....S. [ZBXNEXT-6544] added new set of mathematical, aggregate and string functions for trigger expressions
* commit '7e35f9722b2a2535a23b2b92f8fc836ae396539b': (69 commits)
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] added ChangeLog
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] fixed function grouping in trigger expression condition popup
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] fixed output type definition for math functions
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] improved coding style
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] fixed input-output data definition for history functions
..F....... [ZBXNEXT-6561] updated the list of functions for testing trigger expression
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] updated unit tests for CHistFunctionValidator
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] fixed constant enumeration
..F....... [ZBXNEXT-6561] made "Chars" parameter optional for trim functions; added "Values" parameter for in() function
........S. [ZBXNEXT-6544] fixed missing countunique in zbx_is_trigger_function
..F....... [ZBXNEXT-6544,ZBXNEXT-6561] fixed partial expression (condition) validation
..F....... [ZBXNEXT-6561] fixed e(), pi() and rand() disappear from the list of functions on item change
..F....... [ZBXNEXT-6561] fixed changing item in condition popup always resets function to last(); fixed first function is selected in condition popup when editing trigger expression using expression constructor
A.F....... [ZBXNEXT-6544,ZBXNEXT-6561] updated math function parsing and validation
A.F....... [ZBXNEXT-6544,ZBXNEXT-6561] updated history function validation
.......... [ZBXNEXT-6454] reverted commit to wrong branch
A.F....... [ZBXNEXT-6454] updated history function validation
..F....... [ZBXNEXT-6561] fixed parameters for in() and between(); added quoting for some parameters of new string functions
..F....... [ZBXNEXT-6561] added temporary stubs
........S. [ZBXNEXT-6544] fixed merge consequences
...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_execute.yaml | 1064 | ||||
-rw-r--r-- | tests/libs/zbxserver/evaluate_function.yaml | 1225 |
2 files changed, 2288 insertions, 1 deletions
diff --git a/tests/libs/zbxeval/zbx_eval_execute.yaml b/tests/libs/zbxeval/zbx_eval_execute.yaml index 05ff5b75833..9c75bfc7555 100644 --- a/tests/libs/zbxeval/zbx_eval_execute.yaml +++ b/tests/libs/zbxeval/zbx_eval_execute.yaml @@ -917,4 +917,1068 @@ in: out: result: SUCCEED value: '30' +--- +test case: Expression 'in(1, 2, 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'in(1,2,1)' +out: + result: SUCCEED + value: '1' +--- +test case: Expression 'in(3, 2, 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'in(3, 2, 1)' +out: + result: SUCCEED + value: '0' +--- +test case: Expression 'in(3, 2, 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'in(3, 2, 1)' +out: + result: SUCCEED + value: '0' +--- +test case: Expression 'in("a", 3, "a", 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'in("a", 3, "a", 1)' +out: + result: SUCCEED + value: '1' +--- +test case: Expression 'between(1, 1, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'between(1, 1, 2)' +out: + result: SUCCEED + value: '1' +--- +test case: Expression 'between("1", "1", "2")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'between("1", "1", "2")' +out: + result: SUCCEED + value: '1' +--- +test case: Expression 'between("1", "a", "2")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'between("1", "a", "2")' +out: + result: FAIL +--- +test case: Expression 'between(3, 1, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'between(3, 1, 2)' +out: + result: SUCCEED + value: '0' +--- +test case: Expression 'between(1, 1, 2, 4)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'between(1, 1, 2, 4)' +out: + result: FAIL +--- +test case: Expression 'bitand(14, 3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitand(14, 3)' +out: + result: SUCCEED + value: '2' +--- +test case: Expression 'bitor(3, 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitor(3, 10)' +out: + result: SUCCEED + value: '11' +--- +test case: Expression 'bitxor(14, 3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitxor(14, 3)' +out: + result: SUCCEED + value: '13' +--- +test case: Expression 'bitlshift(3, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitlshift(3, 2)' +out: + result: SUCCEED + value: '12' +--- +test case: Expression 'bitrshift(12, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitrshift(12, 2)' +out: + result: SUCCEED + value: '3' +--- +test case: Expression 'bitnot(18446744073709551602)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitnot(18446744073709551602)' +out: + result: SUCCEED + value: '13' +--- +test case: Expression 'left("Zabbix", 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 2)' +out: + result: SUCCEED + value: 'Za' +--- +test case: Expression 'left("Заббикс", 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Заббикс", 2)' +out: + result: SUCCEED + value: 'За' +--- +test case: Expression 'left("Zabbix", 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 10)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'left("Zabbix", 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 0)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'left("Zabbix", -1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", -1)' +out: + result: FAIL +--- +test case: Expression 'mid("Zabbix", 3, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 3, 2)' +out: + result: SUCCEED + value: 'bb' +--- +test case: Expression 'mid("Zabbix", 3, 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 3, 10)' +out: + result: SUCCEED + value: 'bbix' +--- +test case: Expression 'mid("Заббикс", 3, 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Заббикс", 3, 10)' +out: + result: SUCCEED + value: 'ббикс' +--- +test case: Expression 'mid("Заббикс", 3, 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Заббикс", 3, 2)' +out: + result: SUCCEED + value: 'бб' +--- +test case: Expression 'mid("Zabbix", 3, 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 3, 0)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'mid("Zabbix", 0, 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 0, 0)' +out: + result: FAIL +--- +test case: Expression 'mid("Zabbix", 33, 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 33, 1)' +out: + result: FAIL +--- +test case: Expression 'right("Zabbix", 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 2)' +out: + result: SUCCEED + value: 'ix' +--- +test case: Expression 'right("Zabbix", 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 10)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'right("Заббикс", 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Заббикс", 2)' +out: + result: SUCCEED + value: 'кс' +--- +test case: Expression 'right("Заббикс", 10)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Заббикс", 10)' +out: + result: SUCCEED + value: 'Заббикс' +--- +test case: Expression 'right("Zabbix", 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 0)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'right("Заббикс", 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Заббикс", 0)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'trim("zZabbixz", "z")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim("zZabbixz", "z")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'trim("Zabbixz", "z")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim("Zabbixz", "z")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'trim(" Zabbix ", " ")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim(" Zabbix ", " ")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'trim(" Zabbix", " ")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim(" Zabbix", " ")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'trim(" Zabbix ")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim(" Zabbix ")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'ltrim(" Zabbix ", " ")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'ltrim(" Zabbix ", " ")' +out: + result: SUCCEED + value: 'Zabbix ' +--- +test case: Expression 'rtrim(" Zabbix ", " ")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'rtrim(" Zabbix ", " ")' +out: + result: SUCCEED + value: ' Zabbix' +--- +test case: Expression 'concat("Zabbix ", "server")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'concat("Zabbix ", "server")' +out: + result: SUCCEED + value: 'Zabbix server' +--- +test case: Expression 'repeat("Zabbix", 3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'repeat("Zabbix", 3)' +out: + result: SUCCEED + value: 'ZabbixZabbixZabbix' +--- +test case: Expression 'repeat("ZabbixЗаббикс", 2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'repeat("ZabbixЗаббикс", 2)' +out: + result: SUCCEED + value: 'ZabbixЗаббиксZabbixЗаббикс' +--- +test case: Expression 'repeat("Zabbix", 0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'repeat("Zabbix", 0)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'repeat("Zabbix", 999999)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'repeat("Zabbix", 999999)' +out: + result: FAIL +--- +test case: Expression 'char(65)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'char(65)' +out: + result: SUCCEED + value: 'A' +--- +test case: Expression 'char(256)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'char(256)' +out: + result: FAIL +--- +test case: Expression 'ascii("A")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'ascii("A")' +out: + result: SUCCEED + value: '65' +--- +test case: Expression 'ascii("Ф")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'ascii("Ф")' +out: + result: FAIL +--- +test case: Expression 'bytelength(256)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bytelength(256)' +out: + result: SUCCEED + value: '2' +--- +test case: Expression 'bytelength(123123123123)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bytelength(123123123123)' +out: + result: SUCCEED + value: '5' +--- +test case: Expression 'bytelength("word")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bytelength("word")' +out: + result: SUCCEED + value: '4' +--- +test case: Expression 'bitlength(256)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitlength(256)' +out: + result: SUCCEED + value: '9' +--- +test case: Expression 'bitlength(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitlength(0)' +out: + result: SUCCEED + value: '0' +--- +test case: Expression 'bitlength("word")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'bitlength("word")' +out: + result: SUCCEED + value: '32' +--- +test case: Expression 'insert("Zibix", 2, 2, "abb")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Zibix", 2, 2, "abb")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'insert("Зибикс", 2, 2, "абб")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Зибикс", 2, 2, "абб")' +out: + result: SUCCEED + value: 'Заббикс' +--- +test case: Expression 'insert("zabbix", 2, 2, "")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("zabbix", 2, 2, "")' +out: + result: SUCCEED + value: 'zbix' +--- +test case: Expression 'insert("", 1, 1, "zabbix")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("", 1, 1, "zabbix")' +out: + result: FAIL +--- +test case: Expression 'insert("", 0, 0, "")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("", 0, 0, "")' +out: + result: FAIL +--- +test case: Expression 'insert("Zabbix",2,33,"aaa")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Zabbix",2,33,"aaa")' +out: + result: FAIL +--- +test case: Expression 'replace("Zibix", "ibi", "abbi")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("Zibix", "ibi", "abbi")' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'replace("Зибикс", "иби", "абби")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("Зибикс", "иби", "абби")' +out: + result: SUCCEED + value: 'Заббикс' +--- +test case: Expression 'replace("Zibix", "", "abbi")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("Zibix", "", "abbi")' +out: + result: SUCCEED + value: 'Zibix' +--- +test case: Expression 'replace("Zibix", "ibi", "")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("Zibix", "ibi", "")' +out: + result: SUCCEED + value: 'Zx' +--- +test case: Expression 'replace("", "ibi", "abbi")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("", "ibi", "abbi")' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'replace("Hello Hello", "ll", "y")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'replace("Hello Hello", "ll", "y")' +out: + result: SUCCEED + value: 'Heyo Heyo' +--- +test case: Expression 'sqrt(64)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(64)' +out: + result: SUCCEED + value: 8 +--- +test case: Expression 'sqrt(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(2.5)' +out: + result: SUCCEED + value: 1.5811388300841898 +--- +test case: Expression 'sqrt(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(0)' +out: + result: SUCCEED + value: 0 +--- +test case: Expression 'sqrt(-1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(-1)' +out: + result: FAIL +--- +test case: Expression 'abs(3.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'abs(3.5)' +out: + result: SUCCEED + value: 3.5 +--- +test case: Expression 'abs(-3.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'abs(-3.5)' +out: + result: SUCCEED + value: 3.5 +--- +test case: Expression 'cbrt(64)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cbrt(64)' +out: + result: SUCCEED + value: 4 +--- +test case: Expression 'cbrt(63)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cbrt(63)' +out: + result: SUCCEED + value: 3.9790572078963922 +--- +test case: Expression 'cbrt(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cbrt(2.5)' +out: + result: SUCCEED + value: 1.3572088082974532 +--- +test case: Expression 'ceil(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'ceil(2)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'ceil(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'ceil(2.5)' +out: + result: SUCCEED + value: 3 +--- +test case: Expression 'ceil(-2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'ceil(-2.5)' +out: + result: SUCCEED + value: -2 +--- +test case: Expression 'e()' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'e()' +out: + result: SUCCEED + value: 2.7182818284590451 +--- +test case: Expression 'e(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'e(1)' +out: + result: FAIL +--- +test case: Expression 'exp(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'exp(2)' +out: + result: SUCCEED + value: 7.38905609893065 +--- +test case: Expression 'exp(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'exp(2.5)' +out: + result: SUCCEED + value: 12.182493960703473 +--- +test case: Expression 'expm1(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'expm1(2)' +out: + result: SUCCEED + value: 6.38905609893065 +--- +test case: Expression 'expm1(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'expm1(2.5)' +out: + result: SUCCEED + value: 11.182493960703473 +--- +test case: Expression 'expm1(expm1(2))' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'expm1(expm1(2))' +out: + result: SUCCEED + value: 594.29441538075378 +--- +test case: Expression 'floor(2.6)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'floor(2.6)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'floor(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'floor(2)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'floor(-2.8)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'floor(-2.8)' +out: + result: SUCCEED + value: -3 +--- +test case: Expression 'log(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log(2)' +out: + result: SUCCEED + value: 0.69314718055994529 +--- +test case: Expression 'log(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log(2.5)' +out: + result: SUCCEED + value: 0.91629073187415511 +--- +test case: Expression 'log(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log(0)' +out: + result: FAIL + value: 0 +--- +test case: Expression 'log10(5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log10(5)' +out: + result: SUCCEED + value: 0.69897000433601886 +--- +test case: Expression 'log10(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log10(0)' +out: + result: FAIL + value: 0 +--- +test case: Expression 'log10(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log10(2.5)' +out: + result: SUCCEED + value: 0.3979400086720376 +--- +test case: Expression 'pi()' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'pi()' +out: + result: SUCCEED + value: 3.1415926535897931 +--- +test case: Expression 'pi(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'pi(1)' +out: + result: FAIL +--- +test case: Expression 'power(2,3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(2,3)' +out: + result: SUCCEED + value: 8 +--- +test case: Expression 'power(2,2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(2,2.5)' +out: + result: SUCCEED + value: 5.6568542494923806 +--- +test case: Expression 'power(2.5,2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(2.5,2.5)' +out: + result: SUCCEED + value: 9.8821176880261863 +--- +test case: Expression 'round(2.5482,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'round(2.5482,2)' +out: + result: SUCCEED + value: 2.55 +--- +test case: Expression 'round(2.5482,0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'round(2.5482,0)' +out: + result: SUCCEED + value: 3 +--- +test case: Expression 'round(2.5482,-1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'round(2.5482,-1)' +out: + result: FAIL +--- +test case: Expression 'round(2.5482,1.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'round(2.5482,1.5)' +out: + result: FAIL +--- +test case: Expression 'signum(-2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(-2)' +out: + result: SUCCEED + value: -1 +--- +test case: Expression 'signum(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(2)' +out: + result: SUCCEED + value: 1 +--- +test case: Expression 'signum(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(2.5)' +out: + result: SUCCEED + value: 1 +--- +test case: Expression 'signum(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(0)' +out: + result: SUCCEED + value: 0 +--- +test case: Expression 'truncate(2.5482,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'truncate(2.5482,2)' +out: + result: SUCCEED + value: 2.54 +--- +test case: Expression 'truncate(2.5482,0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'truncate(2.5482,0)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'truncate(2.5482,-1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'truncate(2.5482,-1)' +out: + result: FAIL +--- +test case: Expression 'truncate(2.5482,1.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'truncate(2.5482,1.5)' +out: + result: FAIL +--- +test case: Expression 'acos(0.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'acos(0.5)' +out: + result: SUCCEED + value: 1.0471975511965979 +--- +test case: Expression 'asin(0.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'asin(0.5)' +out: + result: SUCCEED + value: 0.52359877559829893 +--- +test case: Expression 'atan(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan(1)' +out: + result: SUCCEED + value: 0.78539816339744828 +--- +test case: Expression 'atan2(3,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan2(3,2)' +out: + result: SUCCEED + value: 0.982793723247329 +--- +test case: Expression 'atan2(3,2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan2(3,2.5)' +out: + result: SUCCEED + value: 0.87605805059819342 +--- +test case: Expression 'atan2(0,0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan2(0,0)' +out: + result: FAIL +--- +test case: Expression 'cos(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cos(1)' +out: + result: SUCCEED + value: 0.54030230586813977 +--- +test case: Expression 'cosh(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cosh(1)' +out: + result: SUCCEED + value: 1.5430806348152437 +--- +test case: Expression 'cot(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cot(1)' +out: + result: SUCCEED + value: 0.64209261593433076 +--- +test case: Expression 'cot(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cot(0)' +out: + result: FAIL +--- +test case: Expression 'degrees(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'degrees(1)' +out: + result: SUCCEED + value: 57.295779513082323 +--- +test case: Expression 'radians(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'radians(1)' +out: + result: SUCCEED + value: 0.017453292519943295 +--- +test case: Expression 'sin(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sin(1)' +out: + result: SUCCEED + value: 0.8414709848078965 +--- +test case: Expression 'sinh(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sinh(1)' +out: + result: SUCCEED + value: 1.1752011936438014 +--- +test case: Expression 'tan(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'tan(1)' +out: + result: SUCCEED + value: 1.5574077246549023 +--- +test case: Expression 'mod(5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(5,2)' +out: + result: SUCCEED + value: 1 +--- +test case: Expression 'mod(5.5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(5.5,2)' +out: + result: SUCCEED + value: 1.5 +--- +test case: Expression 'mod(-5,-2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(-5,-2)' +out: + result: SUCCEED + value: -1 +--- +test case: Expression 'mod(-5.5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(-5.5,2)' +out: + result: SUCCEED + value: -1.5 +--- +test case: Expression 'mod(-5.5,0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(-5.5,0)' +out: + result: FAIL +--- +test case: Expression 'mod(123,6.253)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(123,6.253)' +out: + result: SUCCEED + value: 4.1929999999999978 +--- +test case: Expression 'rand(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'rand(1)' +out: + result: FAIL +--- +test case: Expression 'power(10,400)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(10,400)' +out: + result: FAIL +--- +test case: Expression 'power(10,300)*power(10,300)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(10,300)*power(10,300)' +out: + result: FAIL ... diff --git a/tests/libs/zbxserver/evaluate_function.yaml b/tests/libs/zbxserver/evaluate_function.yaml index c4f87a3cf8e..e912f1defd5 100644 --- a/tests/libs/zbxserver/evaluate_function.yaml +++ b/tests/libs/zbxserver/evaluate_function.yaml @@ -522,6 +522,269 @@ out: return: FAIL value: 2 --- +test case: Evaluate countunique(5m) FLOAT 5 3 3 1 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 5 + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: 3 + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: 3 + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: 2 + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 4 +--- +test case: Evaluate countunique(5m) FLOAT 1 1 1 1 1 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate countunique(5m) UINT64 5 3 3 1 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 5 + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: 3 + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: 3 + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: 2 + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 4 +--- +test case: Evaluate countunique(5m) UINT64 1 1 1 1 1 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: 1 + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate countunique(5m) STR One One One One One +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - value: One + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: One + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: One + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: One + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: One + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate countunique(5m) STR One Two Three Four One +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - value: One + ts: 2017-01-10 10:01:00.000000000 +00:00 + - value: Two + ts: 2017-01-10 10:02:00.000000000 +00:00 + - value: Three + ts: 2017-01-10 10:03:00.000000000 +00:00 + - value: Four + ts: 2017-01-10 10:04:00.000000000 +00:00 + - value: One + ts: 2017-01-10 10:05:00.000000000 +00:00 + time: 2017-01-10 10:05:00.000000000 +00:00 + function: countunique + params: '5m' +out: + return: SUCCEED + value: 4 +--- +test case: Evaluate countunique(11m) LOG 'abc', 'abc' no sources +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_LOG + data: + - value: abc + source: + logeventid: 1 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: abc + source: + logeventid: 2 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: countunique + params: '11m' +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate countunique(11m) LOG 'qwerty' 'abc' no sources +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_LOG + data: + - value: qwerty + source: + logeventid: 1 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: abc + source: + logeventid: 2 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: countunique + params: '11m' +out: + return: SUCCEED + value: 2 +--- +test case: Evaluate countunique(11m) LOG 'abc' 'abc' different sources +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_LOG + data: + - value: abc + source: serv1 + logeventid: 1 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: abc + source: serv2 + logeventid: 2 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: countunique + params: '11m' +out: + return: SUCCEED + value: 2 +--- +test case: Evaluate countunique(11m) LOG 'abc' 'abc' only source 1 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_LOG + data: + - value: abc + source: serv1 + logeventid: 1 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: abc + source: + logeventid: 2 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: countunique + params: '11m' +out: + return: SUCCEED + value: 2 +--- +test case: Evaluate countunique(11m) LOG 'abc' 'abc' only source 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_LOG + data: + - value: abc + source: + logeventid: 1 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: abc + source: serv2 + logeventid: 2 + severity: 1 + timestamp: 2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: countunique + params: '11m' +out: + return: SUCCEED + value: 2 +--- test case: Evaluate forecast(#5,1h) in: history: @@ -1302,5 +1565,965 @@ in: out: return: SUCCEED value: -5 +--- +test case: Evaluate first() <- 0.1, 0.2. It should FAIL because no argument is specified. +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0.1 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: 0.2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: first + params: '' +out: + return: FAIL + value: +--- +test case: Evaluate first(#2) <- 0.1, 0.2. It should FAIL because number of value is specified. +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0.1 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: 0.2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: first + params: '#2' +out: + return: FAIL + value: +--- +test case: Evaluate first(600) <- 'xyz'. It should FAIL because not enough data. +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - value: xyz + ts: 2017-01-10 10:00:00.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: first + params: '600' +out: + return: FAIL + value: +--- +test case: Evaluate first(601) <- 'xyz' +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - value: xyz + ts: 2017-01-10 10:00:00.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: first + params: '601' +out: + return: SUCCEED + value: 'xyz' +--- +test case: Evaluate first(:now-10m) <- 0.1, 0.2. It should FAIL because no time interval is specified. +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0.1 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: 0.2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + time: 2017-01-10 10:10:00.000000000 +00:00 + function: first + params: :now-10m +out: + return: FAIL + value: +--- +test case: Evaluate first(60:now-10m) <- 0.1, 0.2, 0.3 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0.1 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: 0.2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + - value: 0.3 + ts: 2017-01-10 10:01:00.000000000 +00:00 + time: 2017-01-10 10:11:00.000000000 +00:00 + function: first + params: 60:now-10m +out: + return: SUCCEED + value: 0.2 +--- +test case: Evaluate first(61:now-10m) <- 0.1, 0.2, 0.3 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0.1 + ts: 2017-01-10 10:00:00.000000000 +00:00 + - value: 0.2 + ts: 2017-01-10 10:00:30.000000000 +00:00 + - value: 0.3 + ts: 2017-01-10 10:01:00.000000000 +00:00 + time: 2017-01-10 10:11:00.000000000 +00:00 + function: first + params: 61:now-10m +out: + return: SUCCEED + value: 0.1 +--- +test case: Evaluate kurtosis(3m) FLOAT 0 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: kurtosis + params: 3m +out: + return: FAIL + value: +--- +test case: Evaluate kurtosis(3m) UINT64 0 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: kurtosis + params: 3m +out: + return: FAIL + value: +--- +test case: Evaluate kurtosis(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: kurtosis + params: 3m +out: + return: SUCCEED + value: 1.5 +--- +test case: Evaluate kurtosis(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: kurtosis + params: 3m +out: + return: SUCCEED + value: 1.5 +--- +test case: Evaluate kurtosis(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: kurtosis + params: 6m +out: + return: SUCCEED + value: 3.050521 +--- +test case: Evaluate kurtosis(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: kurtosis + params: 6m +out: + return: SUCCEED + value: 3.050521 +--- +test case: Evaluate mad(7m) FLOAT 1, 1, 2, 2, 4, 6, 9 - odd number of values +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 100 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 4 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 6 + ts: 2021-03-27 10:07:00.000000000 +00:00 + - value: 9 + ts: 2021-03-27 10:08:00.000000000 +00:00 + time: 2021-03-27 10:08:00.000000000 +00:00 + function: mad + params: 7m +out: + return: SUCCEED + value: 1.0 +--- +test case: Evaluate mad(7m) UINT64 1, 1, 2, 2, 4, 6, 9 - odd number of values +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 100 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 4 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 6 + ts: 2021-03-27 10:07:00.000000000 +00:00 + - value: 9 + ts: 2021-03-27 10:08:00.000000000 +00:00 + time: 2021-03-27 10:08:00.000000000 +00:00 + function: mad + params: 7m +out: + return: SUCCEED + value: 1.0 +--- +test case: Evaluate mad(6m) FLOAT 26, 12, 16, 56, 112, 24 - even number of values +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: mad + params: 6m +out: + return: SUCCEED + value: 11.0 +--- +test case: Evaluate mad(6m) UINT64 26, 12, 16, 56, 112, 24 - even number of values +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: mad + params: 6m +out: + return: SUCCEED + value: 11.0 +--- +test case: Evaluate skewness(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: skewness + params: 3m +out: + return: SUCCEED + value: 0 +--- +test case: Evaluate skewness(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: skewness + params: 3m +out: + return: SUCCEED + value: 0 +--- +test case: Evaluate skewness(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: skewness + params: 6m +out: + return: SUCCEED + value: 1.24294 +--- +test case: Evaluate skewness(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: skewness + params: 6m +out: + return: SUCCEED + value: 1.24294 +--- +test case: Evaluate stddevpop(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: stddevpop + params: 3m +out: + return: SUCCEED + value: 0.816497 +--- +test case: Evaluate stddevpop(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: stddevpop + params: 3m +out: + return: SUCCEED + value: 0.816497 +--- +test case: Evaluate stddevpop(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: stddevpop + params: 6m +out: + return: SUCCEED + value: 34.751499 +--- +test case: Evaluate stddevpop(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: stddevpop + params: 6m +out: + return: SUCCEED + value: 34.751499 +--- +test case: Evaluate stddevsamp(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: stddevsamp + params: 3m +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate stddevsamp(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: stddevsamp + params: 3m +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate stddevsamp(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: stddevsamp + params: 6m +out: + return: SUCCEED + value: 38.068360 +--- +test case: Evaluate stddevsamp(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: stddevsamp + params: 6m +out: + return: SUCCEED + value: 38.068360 +--- +test case: Evaluate sumofsquares(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: sumofsquares + params: 3m +out: + return: SUCCEED + value: 5 +--- +test case: Evaluate sumofsquares(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: sumofsquares + params: 3m +out: + return: SUCCEED + value: 5 +--- +test case: Evaluate sumofsquares(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: sumofsquares + params: 6m +out: + return: SUCCEED + value: 17332 +--- +test case: Evaluate sumofsquares(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: sumofsquares + params: 6m +out: + return: SUCCEED + value: 17332 +--- +test case: Evaluate varpop(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: varpop + params: 3m +out: + return: SUCCEED + value: 0.666667 +--- +test case: Evaluate varpop(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: varpop + params: 3m +out: + return: SUCCEED + value: 0.666667 +--- +test case: Evaluate varpop(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: varpop + params: 6m +out: + return: SUCCEED + value: 1207.666667 +--- +test case: Evaluate varpop(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: varpop + params: 6m +out: + return: SUCCEED + value: 1207.666667 +--- +test case: Evaluate varsamp(3m) FLOAT 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: varsamp + params: 3m +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate varsamp(3m) UINT64 0, 1, 2 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 0 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 1 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 2 + ts: 2021-03-27 10:05:00.000000000 +00:00 + time: 2021-03-27 10:05:00.000000000 +00:00 + function: varsamp + params: 3m +out: + return: SUCCEED + value: 1 +--- +test case: Evaluate varsamp(6m) FLOAT 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_FLOAT + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: varsamp + params: 6m +out: + return: SUCCEED + value: 1449.2 +--- +test case: Evaluate varsamp(6m) UINT64 26, 12, 16, 56, 112, 24 +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_UINT64 + data: + - value: 1 + ts: 2021-03-27 10:01:00.000000000 +00:00 + - value: 26 + ts: 2021-03-27 10:02:00.000000000 +00:00 + - value: 12 + ts: 2021-03-27 10:03:00.000000000 +00:00 + - value: 16 + ts: 2021-03-27 10:04:00.000000000 +00:00 + - value: 56 + ts: 2021-03-27 10:05:00.000000000 +00:00 + - value: 112 + ts: 2021-03-27 10:06:00.000000000 +00:00 + - value: 24 + ts: 2021-03-27 10:07:00.000000000 +00:00 + time: 2021-03-27 10:07:00.000000000 +00:00 + function: varsamp + params: 6m +out: + return: SUCCEED + value: 1449.2 ... - |