Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2018-12-21 16:32:17 +0300
committerVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2018-12-21 16:32:17 +0300
commit197db58f35c5b7b1e5f279f4a18c03b038fcdfb5 (patch)
tree0304e2e39675b5ce15f9a23fd80e9e555d8ed06d /tests/zabbix_server/preprocessor
parentb0db776e61d085ac57c365f7361774cffee0c1f8 (diff)
.......... [ZBXNEXT-4724] fixed preprocessing tests
Diffstat (limited to 'tests/zabbix_server/preprocessor')
-rw-r--r--tests/zabbix_server/preprocessor/zbx_item_preproc.c12
-rw-r--r--tests/zabbix_server/preprocessor/zbx_item_preproc.yaml15
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/zabbix_server/preprocessor/zbx_item_preproc.c b/tests/zabbix_server/preprocessor/zbx_item_preproc.c
index 5fdb90c2050..020b0d7ee90 100644
--- a/tests/zabbix_server/preprocessor/zbx_item_preproc.c
+++ b/tests/zabbix_server/preprocessor/zbx_item_preproc.c
@@ -101,6 +101,16 @@ static void read_value(const char *path, unsigned char *value_type, zbx_variant_
zbx_variant_set_str(value, zbx_strdup(NULL, zbx_mock_get_object_member_string(handle, "data")));
}
+static void read_history_value(const char *path, zbx_variant_t *value, zbx_timespec_t *ts)
+{
+ zbx_mock_handle_t handle;
+
+ handle = zbx_mock_get_parameter_handle(path);
+ zbx_strtime_to_timespec(zbx_mock_get_object_member_string(handle, "time"), ts);
+ zbx_variant_set_str(value, zbx_strdup(NULL, zbx_mock_get_object_member_string(handle, "data")));
+ zbx_variant_convert(value, zbx_mock_str_to_variant(zbx_mock_get_object_member_string(handle, "variant")));
+}
+
static void read_step(const char *path, zbx_preproc_op_t *op)
{
zbx_mock_handle_t hop, hop_params, herror, herror_params;
@@ -140,7 +150,7 @@ void zbx_mock_test_entry(void **state)
if (ZBX_MOCK_SUCCESS == zbx_mock_parameter_exists("in.history"))
{
- read_value("in.history", NULL, &history_value, &history_ts);
+ read_history_value("in.history", &history_value, &history_ts);
}
else
{
diff --git a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml
index 93a2d4d01d7..4da941312dd 100644
--- a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml
+++ b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml
@@ -569,6 +569,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 10
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:00 +03:00
data: 5
step:
@@ -587,6 +588,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 5.5
history:
+ variant: ZBX_VARIANT_DBL
time: 2017-10-29 03:14:00 +03:00
data: -4.5
step:
@@ -605,6 +607,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 10
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:00 +03:00
data: 10
step:
@@ -623,6 +626,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 0
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:00 +03:00
data: 10
step:
@@ -640,6 +644,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 1.5
history:
+ variant: ZBX_VARIANT_DBL
time: 2017-10-29 03:14:00 +03:00
data: 0
step:
@@ -658,6 +663,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 1
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:50 +03:00
data: 2
step:
@@ -675,6 +681,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 2
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:15:10 +03:00
data: 1
step:
@@ -692,6 +699,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 2
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:50 +03:00
data: 1
step:
@@ -710,6 +718,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 3
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:50 +03:00
data: 2
step:
@@ -728,6 +737,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 3
history:
+ variant: ZBX_VARIANT_UI64
time: 2017-10-29 03:14:59 +03:00
data: 2
step:
@@ -1303,6 +1313,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 123
history:
+ variant: ZBX_VARIANT_STR
time: 2017-10-29 03:14:00 +03:00
data: 1
step:
@@ -1336,6 +1347,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: 123
history:
+ variant: ZBX_VARIANT_STR
time: 2017-10-29 03:14:00 +03:00
data: 123
step:
@@ -1369,6 +1381,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: abc
history:
+ variant: ZBX_VARIANT_STR
time: 2017-10-29 03:14:30 +03:00
data: xyz
step:
@@ -1388,6 +1401,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: abc
history:
+ variant: ZBX_VARIANT_STR
time: 2017-10-29 03:14:30 +03:00
data: abc
step:
@@ -1406,6 +1420,7 @@ in:
time: 2017-10-29 03:15:00 +03:00
data: abc
history:
+ variant: ZBX_VARIANT_STR
time: 2017-10-29 03:14:00 +03:00
data: abc
step: