diff options
author | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-09-30 10:35:14 +0300 |
---|---|---|
committer | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-09-30 10:35:14 +0300 |
commit | 037fa4296823f1e1f68a4c38b688a78b94c6331e (patch) | |
tree | eac56724c131410a5d4a5313f44c7690847c3bba /tests | |
parent | 242efec09c758c0ff1021702ffe693375697cbfd (diff) | |
parent | 67b4ffa8e7a39bd62cce3037c0bc21e5c35b102d (diff) |
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
Merge in ZBX/zabbix from feature/ZBXNEXT-7920-6.3 to master
* commit '67b4ffa8e7a39bd62cce3037c0bc21e5c35b102d':
........S. [ZBXNEXT-7920] added ChangeLog entry
........S. [ZBXNEXT-7920] added daily range update test
........S. [ZBXNEXT-7920] fixed daily range update test
........S. [ZBXNEXT-7920] fixed daily range update test
........S. [ZBXNEXT-7920] removed redundant code
........S. [ZBXNEXT-7920] removed redundant code
........S. [ZBXNEXT-7931] fixed post init tasks not to fill value cache; improved style for item deletion from value cache
........S. [ZBXNEXT-7920] fixed warnings
.......... [ZBXNEXT-7931] improved mock test comment
.......... [ZBXNEXT-7931] fixed mock test
.......... [ZBXNEXT-7931] fixed mock test
........S. [ZBXNEXT-7931] updated function header
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
........S. [ZBXNEXT-7931] improved value cache not to drop items from cache when no new value arrived in 24 hours
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 |
2 files changed, 184 insertions, 43 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 ... |