[ZBX-15313] Calculated item formula is not parsed correctly Created: 2018 Dec 12 Updated: 2024 Apr 10 Resolved: 2019 Jan 07 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 4.2.0alpha1 |
Fix Version/s: | 3.0.25rc1, 4.0.4rc1, 4.2.0alpha3, 4.2 (plan) |
Type: | Problem report | Priority: | Critical |
Reporter: | Glebs Ivanovskis | Assignee: | Alex Kalimulin |
Resolution: | Fixed | Votes: | 0 |
Labels: | calculateditems | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Team: | Team A |
Team: | Team A |
Sprint: | Sprint 47, Dec 2018, Sprint 48, Jan 2019 |
Story Points: | 0.5 |
Description |
Steps to reproduce:
Result: Expected: |
Comments |
Comment by Glebs Ivanovskis [ 2018 Dec 12 ] |
(1) Also in unit tests there is one missing: ─────┴─────────┴────────────────────────── zbx_function_find ─────┬─────────┬────────────────────────── ... 27 │ OK │ Only openning of LLD macro function must fail 1 28 │ OK │ Only openning of LLD macro function must fail 2 29 │ OK │ Only openning of LLD macro function must fail 4 ─────┴─────────┴────────────────────────── due to lack of YAML document separator (---): --- test case: "Only openning of LLD macro function must fail 3" in: param: '{' out: error: 'Incorrect function expression: {' return: 'FAIL' test case: "Only openning of LLD macro function must fail 4" in: param: '{{#}' out: error: 'Incorrect function expression: {{#}' return: 'FAIL' Kalimulin RESOLVED by r88106 cyclone By the way, "opening", not "openning". wiper: Test case names fixed in r88196 |
Comment by Glebs Ivanovskis [ 2018 Dec 12 ] |
(2) Unit test prints function result with zbx_sysinfo_ret_string() instead of zbx_result_string(). Index: tests/libs/zbxcommon/zbx_function_find.c =================================================================== --- tests/libs/zbxcommon/zbx_function_find.c (revision 87802) +++ tests/libs/zbxcommon/zbx_function_find.c (working copy) @@ -112,8 +112,8 @@ if (expected_result != (actual_result = zbx_function_find(init_param, &func_pos, &par_l, &par_r, error_text, max_error_len))) { - fail_msg("Got %s instead of %s as a result. Error: %s", zbx_sysinfo_ret_string(actual_result), - zbx_sysinfo_ret_string(expected_result), error_text); + fail_msg("Got %s instead of %s as a result. Error: %s", zbx_result_string(actual_result), + zbx_result_string(expected_result), error_text); } if (SUCCEED == expected_result) Kalimulin RESOLVED by r88106 wiper: CLOSED. Alternatively the zbx_mock_assert_result_eq assert macro can be used to check return values. |
Comment by Glebs Ivanovskis [ 2018 Dec 12 ] |
(3) Unit test does not seem to support cases with a valid expression which does not contain a function. Judging by comments next to zbx_function_find(), return should be FAIL (no function found), but unit test then requires an error, which is wrong... If you set return to SUCCEED, then it requires func_pos... Kalimulin WON'T FIX If a valid expression doesn't contain a function zbx_function_find() sets error anyway. |
Comment by Alex Kalimulin [ 2019 Jan 04 ] |
Fixed in:
|