You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
270 lines
7.1 KiB
270 lines
7.1 KiB
1 year ago
|
---
|
||
|
test case: Expression 'forty_two()'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP]
|
||
|
expression: 'forty_two()'
|
||
|
callbacks:
|
||
|
- name: forty_two
|
||
|
args_num: 0
|
||
|
error: 'forced function error'
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'forty_two()'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP]
|
||
|
expression: 'forty_two()'
|
||
|
callbacks:
|
||
|
- name: forty_two
|
||
|
args_num: 0
|
||
|
retval: 42s
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 42
|
||
|
---
|
||
|
test case: Expression 'sum(hist(/host/key,1h))'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'sum(hist(/host/key,1h))'
|
||
|
callbacks:
|
||
|
- name: hist
|
||
|
args_num: 2
|
||
|
retval: [1, 2, 3]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 6
|
||
|
---
|
||
|
test case: Expression 'sum(hist(/host/key,1h),0)'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY,ZBX_EVAL_PARSE_VAR]
|
||
|
expression: 'sum(hist(/host/key,1h),0)'
|
||
|
callbacks:
|
||
|
- name: hist
|
||
|
args_num: 2
|
||
|
retval: [1, 2, 3]
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'min(err(), 1) or 1'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PROCESS_ERROR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_LOGIC]
|
||
|
expression: 'min(err(), 1) or 1'
|
||
|
callbacks:
|
||
|
- name: err
|
||
|
args_num: 0
|
||
|
error: 'forced return error'
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 1
|
||
|
---
|
||
|
test case: Expression 'min(err(), 1) or 1'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_LOGIC]
|
||
|
expression: 'min(err(), 1) or 1'
|
||
|
callbacks:
|
||
|
- name: err
|
||
|
args_num: 0
|
||
|
error: 'forced return error'
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'min(1, 2, err()) and 0'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PROCESS_ERROR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_LOGIC]
|
||
|
expression: 'min(1, 2, err()) and 0'
|
||
|
callbacks:
|
||
|
- name: err
|
||
|
args_num: 0
|
||
|
error: 'forced return error'
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 0
|
||
|
---
|
||
|
test case: Expression 'min(1, 2, err()) and 0'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_LOGIC]
|
||
|
expression: 'min(1, 2, err()) and 0'
|
||
|
callbacks:
|
||
|
- name: err
|
||
|
args_num: 0
|
||
|
error: 'forced return error'
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'sum(hist(/host/key,1h))'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'sum(hist(/host/key,1h))'
|
||
|
callbacks:
|
||
|
- name: hist
|
||
|
args_num: 2
|
||
|
retval: []
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'sum(hist(/host/key,))'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'sum(hist(/host/key,))'
|
||
|
callbacks:
|
||
|
- name: hist
|
||
|
args_num: 2
|
||
|
retval: [1, 2, 3]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 6
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/host/key,1h))'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/host/key,1h))'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 2
|
||
|
retval: [1, 2, 3]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 3
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/host/key,1h)) - no items'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/host/key,1h))'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 2
|
||
|
retval: []
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 0
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key))'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key))'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 2
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"gt",2)'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"gt",2)'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2, 3, 4]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 2
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"gt",2)' - no data
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"gt",2)'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: []
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 0
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"eq","2")'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"eq","2")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2, 3, 2]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 2
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"eq")' - pattern not provided with operator
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"eq")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2, 3, 4]
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"eq","aa")' - DBG
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"eq","aa")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: ["aa", "bb", "cc"]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 1
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"like","aa")' - DBG
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"like","aa")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: ["aa", "bb", "cc"]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 1
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"regexp","aa.")' - DBG
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"regexp","aa.")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: ["aaa", "aab", "aca"]
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 2
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"like","2")' - operation incompatible with numeric values
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"like","2")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2, 3, 4]
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key),"x","2")' - unsupported operator
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR_STR,ZBX_EVAL_PARSE_VAR,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key),"x","2")'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: [1, 2, 3, 4]
|
||
|
out:
|
||
|
result: FAIL
|
||
|
---
|
||
|
test case: Expression 'count(last_foreach(/*/key)) - no items'
|
||
|
in:
|
||
|
rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_ITEM_QUERY]
|
||
|
expression: 'count(last_foreach(/*/key))'
|
||
|
callbacks:
|
||
|
- name: last_foreach
|
||
|
args_num: 1
|
||
|
retval: []
|
||
|
out:
|
||
|
result: SUCCEED
|
||
|
value: 0
|
||
|
...
|