diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2021-03-18 18:30:13 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2021-03-18 18:30:49 +0300 |
commit | 448bdc17523ffbe9a7b2430724087e0fd581009b (patch) | |
tree | 025b20230d652b08e2ccfc1f4701700f7e3bdc48 /tests/libs/zbxeval | |
parent | 68445e0051c556b3b9bc9b88a5c8888cb901669a (diff) |
........S. [ZBXNEXT-6457] fixed callback error return handling with enabled error processing,
fixed #sec:<timeshift> parameter parsing
Diffstat (limited to 'tests/libs/zbxeval')
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_execute_ext.c | 2 | ||||
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_execute_ext.yaml | 8 | ||||
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_parse_expression.yaml | 11 |
3 files changed, 16 insertions, 5 deletions
diff --git a/tests/libs/zbxeval/zbx_eval_execute_ext.c b/tests/libs/zbxeval/zbx_eval_execute_ext.c index 9f2fd6aafd6..0a03776c7bd 100644 --- a/tests/libs/zbxeval/zbx_eval_execute_ext.c +++ b/tests/libs/zbxeval/zbx_eval_execute_ext.c @@ -169,7 +169,7 @@ void zbx_mock_test_entry(void **state) mock_eval_read_values(&ctx, "in.replace"); mock_read_callbacks("in.callbacks"); - returned_ret = zbx_eval_execute_ext(&ctx, NULL, callback_cb, NULL, NULL, &value, &error); + returned_ret = zbx_eval_execute_ext(&ctx, NULL, callback_cb, callback_cb, NULL, &value, &error); if (SUCCEED != returned_ret) printf("ERROR: %s\n", error); diff --git a/tests/libs/zbxeval/zbx_eval_execute_ext.yaml b/tests/libs/zbxeval/zbx_eval_execute_ext.yaml index c01faf467ff..4c9aea8aaca 100644 --- a/tests/libs/zbxeval/zbx_eval_execute_ext.yaml +++ b/tests/libs/zbxeval/zbx_eval_execute_ext.yaml @@ -52,7 +52,7 @@ in: callbacks: - name: err args_num: 0 - reterr: 'forced return error' + error: 'forced return error' out: result: SUCCEED value: 1 @@ -64,7 +64,7 @@ in: callbacks: - name: err args_num: 0 - reterr: 'forced return error' + error: 'forced return error' out: result: FAIL --- @@ -75,7 +75,7 @@ in: callbacks: - name: err args_num: 0 - reterr: 'forced return error' + error: 'forced return error' out: result: SUCCEED value: 0 @@ -87,7 +87,7 @@ in: callbacks: - name: err args_num: 0 - reterr: 'forced return error' + error: 'forced return error' out: result: FAIL --- diff --git a/tests/libs/zbxeval/zbx_eval_parse_expression.yaml b/tests/libs/zbxeval/zbx_eval_parse_expression.yaml index cf0679fd794..b7d1f40f5c0 100644 --- a/tests/libs/zbxeval/zbx_eval_parse_expression.yaml +++ b/tests/libs/zbxeval/zbx_eval_parse_expression.yaml @@ -1438,6 +1438,17 @@ out: - {type: ZBX_EVAL_TOKEN_VAR_NUM, token: '-1', opt: 0} - {type: ZBX_EVAL_TOKEN_OP_EQ, token: '=', opt: 0} result: SUCCEED +--- +test case: Succeed 'last(/host/key,#1:now-1h)' +in: + rules: [ZBX_EVAL_PARSE_ITEM_QUERY,ZBX_EVAL_PARSE_FUNCTION] + expression: 'last(/host/key,#1:now-1h)' +out: + stack: + - {type: ZBX_EVAL_TOKEN_ARG_QUERY, token: '/host/key', opt: 0} + - {type: ZBX_EVAL_TOKEN_ARG_HNUM, token: '#1:now-1h', opt: 0} + - {type: ZBX_EVAL_TOKEN_HIST_FUNCTION, token: 'last', opt: 2} + result: SUCCEED ... |