diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2019-02-22 18:36:22 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2019-02-22 18:36:22 +0300 |
commit | 341d2047015b13fd3c918358907da2b305f293e2 (patch) | |
tree | 2bf4164d3c9b52b9b705fd40a26065f6d96d1c90 /tests/zabbix_server/preprocessor | |
parent | 867b6a416a29e97e57078bab69e94092d4852e39 (diff) |
........S. [ZBXNEXT-4865] fixed parsing and some item_preproc tests
Diffstat (limited to 'tests/zabbix_server/preprocessor')
-rw-r--r-- | tests/zabbix_server/preprocessor/zbx_item_preproc.c | 3 | ||||
-rw-r--r-- | tests/zabbix_server/preprocessor/zbx_item_preproc.yaml | 40 |
2 files changed, 17 insertions, 26 deletions
diff --git a/tests/zabbix_server/preprocessor/zbx_item_preproc.c b/tests/zabbix_server/preprocessor/zbx_item_preproc.c index 031dea56453..c4039196067 100644 --- a/tests/zabbix_server/preprocessor/zbx_item_preproc.c +++ b/tests/zabbix_server/preprocessor/zbx_item_preproc.c @@ -26,6 +26,7 @@ #include "zbxjson.h" #include "dbcache.h" #include "zbxembed.h" +#include "log.h" #include "../../../src/zabbix_server/preprocessor/item_preproc.h" @@ -197,6 +198,8 @@ void zbx_mock_test_entry(void **state) } returned_ret = zbx_item_preproc(0, value_type, &value, &ts, &op, &history_value, &history_ts, &error); + if (SUCCEED != returned_ret) + zabbix_log(LOG_LEVEL_DEBUG, "Preprocessing error: %s", error); if (SUCCEED == is_step_supported(op.type)) expected_ret = zbx_mock_str_to_return_code(zbx_mock_get_parameter_string("out.return")); diff --git a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml index 4fa988e215c..a78a9e57636 100644 --- a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml +++ b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml @@ -1563,9 +1563,7 @@ in: cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - cpu_usage_system{cpu="cpu-total",host=~".*"} - \value + params: "cpu_usage_system{cpu=\"cpu-total\",host=~\".*\"}\n" out: return: SUCCEED value: 1.1940298507220641 @@ -1578,9 +1576,7 @@ in: data: metric_without_timestamp_and_labels 12.47 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - metric_without_timestamp_and_labels - \value + params: "metric_without_timestamp_and_labels\n" out: return: SUCCEED value: 12.47 @@ -1598,9 +1594,7 @@ in: cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - {cpu="cpu0",__name__="cpu_usage_system"} - \value + params: "{cpu=\"cpu0\",__name__=\"cpu_usage_system\"}\n" out: return: SUCCEED value: 1.1940298507220641 @@ -1617,9 +1611,7 @@ in: http_requests_total{method="post",code="400"} 3 1395066363000 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - http_requests_total{code="200"} - \value + params: "http_requests_total{code=\"200\"}\n" out: return: SUCCEED value: 1027 @@ -1635,9 +1627,7 @@ in: cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - "" - \value + params: "\n" out: return: SUCCEED value: 1.1340298507220641 @@ -1653,7 +1643,7 @@ in: cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: cpu_usage_system + params: "cpu_usage_system\n" out: return: SUCCEED value: 1.1340298507220641 @@ -1671,12 +1661,10 @@ in: cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN - params: |- - cpu_usage_system{cpu="cpu0"} == 1.1940298507220641 - host + params: "cpu_usage_system{cpu=\"cpu0\"} == 1.1940298507220641\nhost" out: return: SUCCEED - value: '"host2"' + value: host2 --- test case: prometheus_getmetric8 in: @@ -1684,8 +1672,8 @@ in: value_type: ITEM_VALUE_TYPE_STR time: 2017-10-29 03:15:00 +03:00 data: > - AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxY - yZz_0123456789="anything"} 123123123 + AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789{ + AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_0123456789="anything"} 123123123 step: type: ZBX_PREPROC_PROMETHEUS_PATTERN params: |- @@ -1693,7 +1681,7 @@ in: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_0123456789 out: return: SUCCEED - value: '"anything"' + value: anything --- test case: prometheus_getmetric9 in: @@ -1713,7 +1701,7 @@ in: host out: return: SUCCEED - value: '"host2"' + value: host2 --- test case: prometheus_getmetric10 in: @@ -1730,10 +1718,10 @@ in: type: ZBX_PREPROC_PROMETHEUS_PATTERN params: |- cpu_usage_system{cpu="cpu1"} - \value + host out: return: SUCCEED - value: '"host,3"' + value: host,3 --- test case: prometheus_getmetric11 in: |