diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-09-30 13:39:31 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-09-30 13:39:31 +0300 |
commit | 8ff6adca589211f26d25b27035bcc75e3766ea01 (patch) | |
tree | 65252d9290c5e9f56cce620b4f1683f75539be9b /tests | |
parent | bdc05dc31a197c73cebefe31676a454a2038f71f (diff) | |
parent | 9c4300a00b1a3c6f2631edf232826223c088f00e (diff) |
.......... [DEV-2113] updated to the latest master
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libs/zbxdbcache/zbx_vc_add_values.yaml | 107 | ||||
-rw-r--r-- | tests/libs/zbxdbcache/zbx_vc_get_values.yaml | 120 | ||||
-rw-r--r-- | tests/zabbix_server/service/mock_service.c | 2 |
3 files changed, 185 insertions, 44 deletions
diff --git a/tests/libs/zbxdbcache/zbx_vc_add_values.yaml b/tests/libs/zbxdbcache/zbx_vc_add_values.yaml index 139e6c8d607..cc16058eb37 100644 --- a/tests/libs/zbxdbcache/zbx_vc_add_values.yaml +++ b/tests/libs/zbxdbcache/zbx_vc_add_values.yaml @@ -930,8 +930,8 @@ out: mode: ZBX_VC_MODE_NORMAL --- # TC16 -# Test that adding values causes old data (outside active request range) to be dropped. -test case: Add values after time causing old data to be dropped +# Test that adding values to item not accessed for a day does not cause item to be dropped +test case: Add values after item was not accessed for a day in: history: - itemid: 1 @@ -963,13 +963,13 @@ in: count: 0 end: 2017-01-10 10:00:05.000000000 +00:00 test: - time: 2017-01-10 10:20:00.000000000 +00:00 + time: 2017-01-11 10:20:00.000000000 +00:00 values: - itemid: 1 value type: ITEM_VALUE_TYPE_STR data: &new1 value: value 10.5.9 - ts: 2017-01-10 10:10:05.900000000 +00:00 + ts: 2017-01-11 10:10:05.900000000 +00:00 out: return: SUCCEED cache: @@ -977,16 +977,23 @@ out: - itemid: 1 value type: ITEM_VALUE_TYPE_STR data: + - *row42 + - *row45 + - *row47 + - *row52 + - *row55 + - *row57 - *new1 status: active_range: 601 - values_total: 1 - db_cached_from: 2017-01-10 10:00:06.000000000 +00:00 + values_total: 7 + db_cached_from: 2017-01-10 10:00:00.000000000 +00:00 mode: ZBX_VC_MODE_NORMAL --- # TC17 -# Test that adding values to item not accessed for a day causes item to be dropped -test case: Add values after item was not accessed for a day +# Test that adding single value after long period does not cause old data to be dropped as request range should be +# calculated from last received value with which active range was calculated +test case: Test that adding single value does not cause old data to be dropped (previous value is used for active range). in: history: - itemid: 1 @@ -1018,17 +1025,97 @@ in: count: 0 end: 2017-01-10 10:00:05.000000000 +00:00 test: - time: 2017-01-11 10:20:00.000000000 +00:00 + time: 2017-01-10 10:20:00.000000000 +00:00 values: - itemid: 1 value type: ITEM_VALUE_TYPE_STR data: &new1 value: value 10.5.9 - ts: 2017-01-11 10:10:05.900000000 +00:00 + ts: 2017-01-10 10:10:05.900000000 +00:00 out: return: SUCCEED cache: items: - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - *row42 + - *row45 + - *row47 + - *row52 + - *row55 + - *row57 + - *new1 + status: + active_range: 601 + values_total: 7 + db_cached_from: 2017-01-10 10:00:00.000000000 +00:00 + mode: ZBX_VC_MODE_NORMAL +--- +# TC18 +# Test that adding values causes old data (outside active request range) to be dropped. +test case: Add values after time causing old data to be dropped +in: + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - &row42 + value: value 4.2 + ts: 2017-01-10 10:00:04.200000000 +00:00 + - &row45 + value: value 4.5 + ts: 2017-01-10 10:00:04.500000000 +00:00 + - &row47 + value: value 4.7 + ts: 2017-01-10 10:00:04.700000000 +00:00 + - &row52 + value: value 5.2 + ts: 2017-01-10 10:00:05.200000000 +00:00 + - &row55 + value: value 5.5 + ts: 2017-01-10 10:00:05.500000000 +00:00 + - &row57 + value: value 5.7 + ts: 2017-01-10 10:00:05.700000000 +00:00 + precache: + - time: 2017-01-10 10:10:00.000000000 +00:00 + itemid: 1 + value type: ITEM_VALUE_TYPE_STR + seconds: 5 + count: 0 + end: 2017-01-10 10:00:05.000000000 +00:00 + test: + time: 2017-01-10 10:21:00.000000000 +00:00 + values: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: &new1 + value: value 10.5.1 + ts: 2017-01-10 10:20:01.900000000 +00:00 + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: &new2 + value: value 10.5.2 + ts: 2017-01-10 10:20:02.900000000 +00:00 + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: &new3 + value: value 10.5.3 + ts: 2017-01-10 10:20:03.900000000 +00:00 +out: + return: SUCCEED + cache: + items: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - *new1 + - *new2 + - *new3 + status: + active_range: 601 + values_total: 3 + db_cached_from: 2017-01-10 10:00:06.000000000 +00:00 mode: ZBX_VC_MODE_NORMAL ... diff --git a/tests/libs/zbxdbcache/zbx_vc_get_values.yaml b/tests/libs/zbxdbcache/zbx_vc_get_values.yaml index a069c3f7bcc..43a3d06a1d5 100644 --- a/tests/libs/zbxdbcache/zbx_vc_get_values.yaml +++ b/tests/libs/zbxdbcache/zbx_vc_get_values.yaml @@ -2225,9 +2225,20 @@ out: # TC38 # Test if the active range ir properly reduced to the daily range each day test case: Active range change in next few days -include: &include zbx_vc_get_values.inc.yaml in: - history: [*include] + history: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - &row1 + value: value 1.2 + ts: 2017-01-10 10:00:01.200000000 +00:00 + - &row2 + value: value 1.4 + ts: 2017-01-11 10:00:01.500000000 +00:00 + - &row3 + value: value 1.5 + ts: 2017-01-11 12:10:01.500000000 +00:00 precache: - time: 2017-01-10 10:10:00.000000000 +00:00 itemid: 1 @@ -2255,39 +2266,12 @@ out: - itemid: 1 value type: ITEM_VALUE_TYPE_STR data: - - value: value 1.2 - ts: 2017-01-10 10:00:01.200000000 +00:00 - - value: value 1.5 - ts: 2017-01-10 10:00:01.500000000 +00:00 - - value: value 1.7 - ts: 2017-01-10 10:00:01.700000000 +00:00 - - value: value 2.2 - ts: 2017-01-10 10:00:02.200000000 +00:00 - - value: value 2.5 - ts: 2017-01-10 10:00:02.500000000 +00:00 - - value: value 2.7 - ts: 2017-01-10 10:00:02.700000000 +00:00 - - value: value 3.2 - ts: 2017-01-10 10:00:03.200000000 +00:00 - - value: value 3.5 - ts: 2017-01-10 10:00:03.500000000 +00:00 - - value: value 3.7 - ts: 2017-01-10 10:00:03.700000000 +00:00 - - value: value 4.2 - ts: 2017-01-10 10:00:04.200000000 +00:00 - - value: value 4.5 - ts: 2017-01-10 10:00:04.500000000 +00:00 - - value: value 4.7 - ts: 2017-01-10 10:00:04.700000000 +00:00 - - value: value 5.2 - ts: 2017-01-10 10:00:05.200000000 +00:00 - - value: value 5.5 - ts: 2017-01-10 10:00:05.500000000 +00:00 - - value: value 5.7 - ts: 2017-01-10 10:00:05.700000000 +00:00 + - *row1 + - *row2 + - *row3 status: active_range: 101 - values_total: 15 + values_total: 3 db_cached_from: 2017-01-10 09:50:01.000000000 +00:00 mode: ZBX_VC_MODE_NORMAL hits: 0 @@ -3101,4 +3085,74 @@ out: mode: ZBX_VC_MODE_NORMAL hits: 0 misses: 2 +--- +# Test if the active range is not reduced to the daily range each day if there are no new values that day +test case: Active range change in next few days +include: &include zbx_vc_get_values.inc.yaml +in: + history: [*include] + precache: + - time: 2017-01-10 10:10:00.000000000 +00:00 + itemid: 1 + value type: ITEM_VALUE_TYPE_STR + seconds: 600 + count: 0 + end: 2017-01-10 10:00:01.999999999 +00:00 + - time: 2017-01-11 11:10:00.000000000 +00:00 + itemid: 1 + value type: ITEM_VALUE_TYPE_STR + seconds: 100 + count: 0 + end: 2017-01-11 11:10:00.999999999 +00:00 + test: + time: 2017-01-12 12:10:00.000000000 +00:00 + itemid: 1 + value type: ITEM_VALUE_TYPE_STR + seconds: 100 + count: 0 + end: 2017-01-12 12:10:00.999999999 +00:00 +out: + values: [] + cache: + items: + - itemid: 1 + value type: ITEM_VALUE_TYPE_STR + data: + - value: value 1.2 + ts: 2017-01-10 10:00:01.200000000 +00:00 + - value: value 1.5 + ts: 2017-01-10 10:00:01.500000000 +00:00 + - value: value 1.7 + ts: 2017-01-10 10:00:01.700000000 +00:00 + - value: value 2.2 + ts: 2017-01-10 10:00:02.200000000 +00:00 + - value: value 2.5 + ts: 2017-01-10 10:00:02.500000000 +00:00 + - value: value 2.7 + ts: 2017-01-10 10:00:02.700000000 +00:00 + - value: value 3.2 + ts: 2017-01-10 10:00:03.200000000 +00:00 + - value: value 3.5 + ts: 2017-01-10 10:00:03.500000000 +00:00 + - value: value 3.7 + ts: 2017-01-10 10:00:03.700000000 +00:00 + - value: value 4.2 + ts: 2017-01-10 10:00:04.200000000 +00:00 + - value: value 4.5 + ts: 2017-01-10 10:00:04.500000000 +00:00 + - value: value 4.7 + ts: 2017-01-10 10:00:04.700000000 +00:00 + - value: value 5.2 + ts: 2017-01-10 10:00:05.200000000 +00:00 + - value: value 5.5 + ts: 2017-01-10 10:00:05.500000000 +00:00 + - value: value 5.7 + ts: 2017-01-10 10:00:05.700000000 +00:00 + status: + active_range: 1200 + values_total: 15 + db_cached_from: 2017-01-10 09:50:01.000000000 +00:00 + mode: ZBX_VC_MODE_NORMAL + hits: 0 + misses: 0 ... diff --git a/tests/zabbix_server/service/mock_service.c b/tests/zabbix_server/service/mock_service.c index d350e69a8a1..52cc09b451d 100644 --- a/tests/zabbix_server/service/mock_service.c +++ b/tests/zabbix_server/service/mock_service.c @@ -47,7 +47,7 @@ int CONFIG_SERVICEMAN_SYNC_FREQUENCY = 0; pid_t *threads; int threads_num; -void update_selfmon_counter(unsigned char state) +void zbx_update_selfmon_counter(unsigned char state) { ZBX_UNUSED(state); } |