From e61a2b6b20599259e471592b383dfd6348f8018c Mon Sep 17 00:00:00 2001 From: Mathew Date: Thu, 11 Jun 2026 13:00:58 +0000 Subject: [PATCH] 0003-add-zbxnext-8813-trapper-test --- .../trapper/zbx_trapper_preproc_test_run.yaml | 111 ++++++++++++++++++++++- 1 file changed, 110 insertions(+), 1 deletion(-) diff --git a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.yaml b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.yaml index a250849953..cd317e1fe4 100644 --- a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.yaml +++ b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.yaml @@ -611,6 +611,116 @@ out: "result": "x" } --- +test case: 'Apply Prometheus pattern to 5.242839e+06 for uint value testing single step' +in: + request: | + { + "data": { + "item": { + "steps":[ + { + "error_handler_params": "", + "params": "go_memstats_alloc_bytes\nvalue\n", + "error_handler": 0, + "type": 22 + } + ], + "value_type": 3, + "value": "go_memstats_alloc_bytes 5.242839e+06" + }, + "options": { + "single": true + } + }, + "request": "preprocessing.test", + "sid": "6ed71f17963a881bd010e63b01c39484" + } +out: + return: SUCCEED + response: | + { + "steps": [ + { + "result": "5242839" + } + ], + "result": "5242839" + } +--- +test case: 'Apply Prometheus function sum to scientific values for uint value testing single step' +in: + request: | + { + "data": { + "item": { + "steps":[ + { + "error_handler_params": "", + "params": "go_memstats_alloc_bytes\nfunction\nsum", + "error_handler": 0, + "type": 22 + } + ], + "value_type": 3, + "value": "go_memstats_alloc_bytes{cpu=\"0\"} 7.2057594037927936e+16\ngo_memstats_alloc_bytes{cpu=\"1\"} 7.2057594037927936e+16" + }, + "options": { + "single": true + } + }, + "request": "preprocessing.test", + "sid": "6ed71f17963a881bd010e63b01c39484" + } +out: + return: SUCCEED + response: | + { + "steps": [ + { + "result": "144115188075855872" + } + ], + "result": "144115188075855872" + } +--- +test case: 'Apply Prometheus pattern with no matching metrics for uint value testing single step' +in: + request: | + { + "data": { + "item": { + "steps":[ + { + "error_handler_params": "", + "params": "go_memstats_alloc_bytes\nvalue\n", + "error_handler": 0, + "type": 22 + } + ], + "value_type": 3, + "value": "go_memstats_sys_bytes 5.242839e+06" + }, + "options": { + "single": true + } + }, + "request": "preprocessing.test", + "sid": "6ed71f17963a881bd010e63b01c39484" + } +out: + return: SUCCEED + response: | + { + "steps": [ + { + "error": { + "value": "cannot apply Prometheus pattern: data extraction error: no matching metrics found" + } + } + ], + "error": "cannot apply Prometheus pattern: data extraction error: no matching metrics found" + } +--- test case: 'Apply delta() to 100, 700' in: request: | @@ -1600,4 +1710,3 @@ out: "result": "50000002900000016" } ... - -- 2.47.3