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
path: root/tests
diff options
context:
space:
mode:
authorMichael Veksler <Mihails.Vekslers@zabbix.com>2021-10-07 17:56:47 +0300
committerMichael Veksler <Mihails.Vekslers@zabbix.com>2021-10-07 17:56:47 +0300
commit211f969f6190b92b7eb8c878bb77f24c94bd2946 (patch)
tree840a5a96a3b03a92e39618600997e8fd1e8f7502 /tests
parenta32f671b5623f5990c8b2c0d88be394c74b10109 (diff)
parent07e27fa5feabd4ab8f34ebcfbef0176645a5f278 (diff)
.......PS. [ZBXNEXT-6879] updated to the latest master
Diffstat (limited to 'tests')
-rw-r--r--tests/libs/zbxcommshigh/zbx_tcp_recv_ext.c9
-rw-r--r--tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml10
-rw-r--r--tests/zabbix_server/service/service_get_rootcause_eventids.yaml176
3 files changed, 192 insertions, 3 deletions
diff --git a/tests/libs/zbxcommshigh/zbx_tcp_recv_ext.c b/tests/libs/zbxcommshigh/zbx_tcp_recv_ext.c
index b26df85823a..56a5dbeba31 100644
--- a/tests/libs/zbxcommshigh/zbx_tcp_recv_ext.c
+++ b/tests/libs/zbxcommshigh/zbx_tcp_recv_ext.c
@@ -33,7 +33,7 @@ void zbx_mock_test_entry(void **state)
char *buffer;
zbx_socket_t s;
ssize_t received;
- int expected_ret;
+ int expected_ret, offset = ZBX_TCP_HEADER_DATALEN_LEN;
ZBX_UNUSED(state);
@@ -41,7 +41,7 @@ void zbx_mock_test_entry(void **state)
zbx_tcp_connect(&s, NULL, "127.0.0.1", 10050, 0, ZBX_TCP_SEC_UNENCRYPTED, NULL, NULL));
expected_ret = zbx_mock_str_to_return_code(zbx_mock_get_parameter_string("out.return"));
- received = zbx_tcp_recv_ext(&s, 0);
+ received = zbx_tcp_recv_ext(&s, 0, ZBX_TCP_LARGE);
if (FAIL == expected_ret)
{
@@ -58,7 +58,10 @@ void zbx_mock_test_entry(void **state)
buffer = zbx_yaml_assemble_binary_sequence("out.fragments", received);
- if (0 != memcmp(buffer + ZBX_TCP_HEADER_DATALEN_LEN, s.buffer, received - ZBX_TCP_HEADER_DATALEN_LEN))
+ if (0 != (ZBX_TCP_LARGE & s.protocol))
+ offset += 8;
+
+ if (0 != memcmp(buffer + offset, s.buffer, received - offset))
fail_msg("Received message mismatch expected");
zbx_tcp_close(&s);
diff --git a/tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml b/tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml
index b14cd5d351d..048210547d8 100644
--- a/tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml
+++ b/tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml
@@ -35,3 +35,13 @@ out:
fragments:
- 'ZBXD\x03\x12\x00\x00\x00\x0A\x00\x00\x00agent.ping'
return: FAIL
+---
+test case: Compressed data with large length fields
+in:
+ fragments: &fragments
+ - 'ZBXD\x07\x12\x00\x00\x00\x00\x00\x00\x00\x0A\x00\x00\x00\x00\x00\x00\x00\x78\x9C\x4B\x4C\x4F\xCD\x2B\xD1\x2B\xC8\xCC\x4B\x07\x00\x15\x79\x03\xEC'
+out:
+ fragments:
+ - 'ZBXD\x07\x12\x00\x00\x00\x00\x00\x00\x00\x0A\x00\x00\x00\x00\x00\x00\x00agent.ping'
+ return: SUCCEED
+ bytes: 31
diff --git a/tests/zabbix_server/service/service_get_rootcause_eventids.yaml b/tests/zabbix_server/service/service_get_rootcause_eventids.yaml
index 7ce4ae9d264..0aadf3ef696 100644
--- a/tests/zabbix_server/service/service_get_rootcause_eventids.yaml
+++ b/tests/zabbix_server/service/service_get_rootcause_eventids.yaml
@@ -142,4 +142,180 @@ in:
service: S27
out:
events: [19]
+---
+test case: Accounting for propagation rules with default status calculation
+in:
+ services:
+ - name: S1
+ status: 2
+ children: [S2]
+ algorithm: MIN
+ - name: S2
+ status: 3
+ children: [S3, S4]
+ algorithm: MIN
+ propagation: {"action": DECREASE, "value": 1}
+ - name: S3
+ status: 2
+ events:
+ - {"id":3, "severity":2}
+ - name: S4
+ status: 3
+ events:
+ - {"id":4, "severity":3}
+ service: S1
+out:
+ events: [3, 4]
+---
+test case: Accounting for propagation rules with additional rules (1)
+in:
+ services:
+ - name: S1
+ status: 2
+ children: [S2]
+ algorithm: OK
+ rules:
+ - {"type": N_GE, "limit":2, "value":1, "status":3}
+ - name: S2
+ status: 3
+ children: [S3, S4]
+ algorithm: MIN
+ propagation: {"action": DECREASE, "value": 1}
+ - name: S3
+ status: 2
+ events:
+ - {"id":3, "severity":2}
+ - name: S4
+ status: 3
+ events:
+ - {"id":4, "severity":3}
+ service: S1
+out:
+ events: [4]
+---
+test case: Accounting for propagation rules with additional rules (2)
+in:
+ services:
+ - name: S1
+ status: 2
+ children: [S2]
+ algorithm: OK
+ rules:
+ - {"type": N_GE, "limit":3, "value":1, "status":3}
+ - name: S2
+ status: 2
+ children: [S3, S4]
+ algorithm: MIN
+ propagation: {"action": SET, "value": 3}
+ - name: S3
+ status: 1
+ events:
+ - {"id":3, "severity":1}
+ - name: S4
+ status: 2
+ events:
+ - {"id":4, "severity":2}
+ service: S1
+out:
+ events: [3, 4]
+---
+test case: Overriding min-status of default rules with additional rules
+in:
+ services:
+ - name: S1
+ status: 3
+ children: [S2]
+ algorithm: OK
+ rules:
+ - {"type": N_GE, "limit":2, "value":1, "status":3}
+ - name: S2
+ status: 3
+ children: [S3, S4, S5]
+ algorithm: MIN
+ rules:
+ - {"type": N_GE, "limit":1, "value":1, "status":2}
+ - name: S3
+ status: 1
+ events:
+ - {"id":3, "severity":1}
+ - name: S4
+ status: 2
+ children: [S6, S7]
+ algorithm: MIN
+ - name: S5
+ status: 3
+ algorithm: MIN
+ events:
+ - {"id":5, "severity":3}
+ - name: S6
+ status: 1
+ events:
+ - {"id":6, "severity":1}
+ - name: S7
+ status: 2
+ events:
+ - {"id":7, "severity":2}
+ service: S1
+out:
+ events: [3, 5, 6, 7]
+---
+test case: Applying min-status to events (min)
+in:
+ services:
+ - name: S1
+ status: 2
+ children: [S2]
+ algorithm: OK
+ rules:
+ - {"type": N_GE, "limit":3, "value":1, "status":3}
+ - name: S2
+ status: 3
+ children: [S3, S4]
+ algorithm: MIN
+ status: 3
+ - name: S3
+ status: 3
+ events:
+ - {"id":1, "severity":1}
+ - {"id":2, "severity":2}
+ - {"id":3, "severity":3}
+ - name: S4
+ status: 3
+ events:
+ - {"id":4, "severity":1}
+ - {"id":5, "severity":2}
+ - {"id":6, "severity":3}
+ service: S1
+out:
+ events: [3, 6]
+---
+test case: Applying min-status to events (max)
+in:
+ services:
+ - name: S1
+ status: 2
+ children: [S2]
+ algorithm: OK
+ rules:
+ - {"type": N_GE, "limit":3, "value":1, "status":3}
+ - name: S2
+ status: 3
+ children: [S3, S4]
+ algorithm: MAX
+ status: 3
+ - name: S3
+ status: 3
+ events:
+ - {"id":1, "severity":1}
+ - {"id":2, "severity":2}
+ - {"id":3, "severity":3}
+ - name: S4
+ status: 3
+ events:
+ - {"id":4, "severity":1}
+ - {"id":5, "severity":2}
+ - {"id":6, "severity":3}
+ service: S1
+out:
+ events: [1, 2, 3, 4, 5, 6]
...