diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-09-30 13:50:19 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-09-30 13:50:19 +0300 |
commit | c56e263c82c699c9b45364d6ef667b7c4989bc7f (patch) | |
tree | 2ae168b0816a74ee000c27d26c9d45d5667ebf21 /tests | |
parent | 615dab8a6a3a3f62129308f21297cd54b6282275 (diff) | |
parent | 9c4300a00b1a3c6f2631edf232826223c088f00e (diff) |
.......... [DEV-2241] updated to the latest master
Diffstat (limited to 'tests')
29 files changed, 340 insertions, 196 deletions
diff --git a/tests/libs/zbxcommon/parse_key.c b/tests/libs/zbxcommon/parse_key.c index 657cfeadca9..b980c044159 100644 --- a/tests/libs/zbxcommon/parse_key.c +++ b/tests/libs/zbxcommon/parse_key.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" void zbx_mock_test_entry(void **state) { diff --git a/tests/libs/zbxcommon/replace_key_params_dyn.c b/tests/libs/zbxcommon/replace_key_params_dyn.c index bb69a4e789c..b3ce1b41d18 100644 --- a/tests/libs/zbxcommon/replace_key_params_dyn.c +++ b/tests/libs/zbxcommon/replace_key_params_dyn.c @@ -22,7 +22,7 @@ #include "zbxserver.h" #include "zbxparam.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" /****************************************************************************** * * @@ -43,9 +43,9 @@ static int replace_key_param_cb(const char *data, int key_type, int level, int n *param = zbx_strdup(NULL, data); - unquote_key_param(*param); + zbx_unquote_key_param(*param); - if (FAIL == (ret = quote_key_param(param, quoted))) + if (FAIL == (ret = zbx_quote_key_param(param, quoted))) zbx_free(*param); return ret; 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/libs/zbxsysinfo/Makefile.am b/tests/libs/zbxsysinfo/Makefile.am index ae6a391238c..fde61523899 100644 --- a/tests/libs/zbxsysinfo/Makefile.am +++ b/tests/libs/zbxsysinfo/Makefile.am @@ -10,8 +10,8 @@ endif if AGENT AGENT_tests = \ - process \ - process_http \ + zbx_execute_agent_check \ + zbx_execute_agent_check_http \ check_key_access_rules endif @@ -182,15 +182,15 @@ COMMON_LIB_FILES = \ $(top_srcdir)/tests/libzbxmocktest.a \ $(top_srcdir)/tests/libzbxmockdata.a -process_SOURCES = \ - process.c \ +zbx_execute_agent_check_SOURCES = \ + zbx_execute_agent_check.c \ ../../zbxmocktest.h -process_LDADD = $(COMMON_LIB_FILES) \ +zbx_execute_agent_check_LDADD = $(COMMON_LIB_FILES) \ $(top_srcdir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \ $(top_srcdir)/src/libs/zbxhttp/libzbxhttp.a -process_WRAP_FUNCS = \ +zbx_execute_agent_check_WRAP_FUNCS = \ -Wl,--wrap=SYSTEM_LOCALTIME \ -Wl,--wrap=VFS_FILE_SIZE \ -Wl,--wrap=VFS_FILE_TIME \ @@ -205,30 +205,30 @@ process_WRAP_FUNCS = \ -Wl,--wrap=NET_TCP_PORT \ -Wl,--wrap=SYSTEM_USERS_NUM -process_LDADD += @AGENT_LIBS@ +zbx_execute_agent_check_LDADD += @AGENT_LIBS@ -process_LDFLAGS = @AGENT_LDFLAGS@ $(process_WRAP_FUNCS) +zbx_execute_agent_check_LDFLAGS = @AGENT_LDFLAGS@ $(zbx_execute_agent_check_WRAP_FUNCS) -process_CFLAGS = -DZABBIX_DAEMON -I@top_srcdir@/tests +zbx_execute_agent_check_CFLAGS = -DZABBIX_DAEMON -I@top_srcdir@/tests -# process_http +# zbx_execute_agent_check_http -process_http_SOURCES = \ - process_http.c \ +zbx_execute_agent_check_http_SOURCES = \ + zbx_execute_agent_check_http.c \ ../../zbxmocktest.h -process_http_LDADD = $(COMMON_LIB_FILES) +zbx_execute_agent_check_http_LDADD = $(COMMON_LIB_FILES) -process_http_WRAP_FUNCS = \ +zbx_execute_agent_check_http_WRAP_FUNCS = \ -Wl,--wrap=WEB_PAGE_GET \ -Wl,--wrap=WEB_PAGE_PERF \ -Wl,--wrap=WEB_PAGE_REGEXP -process_http_LDADD += @AGENT_LIBS@ +zbx_execute_agent_check_http_LDADD += @AGENT_LIBS@ -process_http_LDFLAGS = @AGENT_LDFLAGS@ +zbx_execute_agent_check_http_LDFLAGS = @AGENT_LDFLAGS@ -process_http_CFLAGS = $(process_http_WRAP_FUNCS) -I@top_srcdir@/tests +zbx_execute_agent_check_http_CFLAGS = $(zbx_execute_agent_check_http_WRAP_FUNCS) -I@top_srcdir@/tests # check_key_access_rules diff --git a/tests/libs/zbxsysinfo/check_key_access_rules.c b/tests/libs/zbxsysinfo/check_key_access_rules.c index 66a9035cb31..bde43ef6013 100644 --- a/tests/libs/zbxsysinfo/check_key_access_rules.c +++ b/tests/libs/zbxsysinfo/check_key_access_rules.c @@ -25,8 +25,7 @@ #include "zbxcommon.h" #include "zbxalgo.h" #include "module.h" -#include "sysinfo.h" - +#include "zbxsysinfo.h" extern zbx_vector_ptr_t key_access_rules; @@ -53,21 +52,21 @@ void zbx_mock_test_entry(void **state) ZBX_UNUSED(state); hrules = zbx_mock_get_parameter_handle("in.rules"); - init_key_access_rules(); + zbx_init_key_access_rules(); while (ZBX_MOCK_SUCCESS == zbx_mock_vector_element(hrules, &hrule)) { type = zbx_mock_get_object_member_string(hrule, "type"); pattern = zbx_mock_get_object_member_string(hrule, "pattern"); - if (SUCCEED != add_key_access_rule("key", (char *)pattern, zbx_mock_str_to_key_access_type(type))) + if (SUCCEED != zbx_add_key_access_rule("key", (char *)pattern, zbx_mock_str_to_key_access_type(type))) { - free_key_access_rules(); + zbx_free_key_access_rules(); fail_msg("Bad key access rule definition"); } } - finalize_key_access_rules_configuration(); + zbx_finalize_key_access_rules_configuration(); if (ZBX_MOCK_NO_EXIT_CODE != (error = zbx_mock_exit_code(&exit_code))) { @@ -91,7 +90,7 @@ void zbx_mock_test_entry(void **state) key = zbx_mock_get_object_member_string(hmetric, "metric"); expected_ret = zbx_mock_str_to_key_access_type(zbx_mock_get_object_member_string(hmetric, "result")); - actual_ret = check_key_access_rules(key); + actual_ret = zbx_check_key_access_rules(key); if (expected_ret != actual_ret) fail_msg("Unexpected result for metric \"%s\": %s, expected %s", key, @@ -99,5 +98,5 @@ void zbx_mock_test_entry(void **state) expected_ret == ZBX_KEY_ACCESS_ALLOW ? "Allow" : "Deny"); } - free_key_access_rules(); + zbx_free_key_access_rules(); } diff --git a/tests/libs/zbxsysinfo/check_service_test.c b/tests/libs/zbxsysinfo/check_service_test.c index a5ce2e3300f..2b46b122baa 100644 --- a/tests/libs/zbxsysinfo/check_service_test.c +++ b/tests/libs/zbxsysinfo/check_service_test.c @@ -22,7 +22,7 @@ #include "zbxmockutil.h" #include "../../../src/libs/zbxsysinfo/simple/simple.h" -#include "../../../include/sysinfo.h" +#include "../../../include/zbxsysinfo.h" int __wrap_tcp_expect(const char *host, unsigned short port, int timeout, const char *request, int (*validate_func)(const char *), const char *sendtoclose, int *value_int) @@ -52,8 +52,8 @@ void zbx_mock_test_entry(void **state) default_addr = zbx_mock_get_parameter_string("in.interface"); ip = zbx_mock_get_parameter_string("in.ip"); - init_result(&result); - init_request(&request); + zbx_init_agent_result(&result); + zbx_init_agent_request(&request); *key = '\0'; strcat(key, "net.tcp.service[smtp"); @@ -64,7 +64,7 @@ void zbx_mock_test_entry(void **state) } strcat(key, "]"); - parse_item_key(key, &request); + zbx_parse_item_key(key, &request); returned_code = check_service(&request, default_addr, &result, 0); if (SUCCEED != returned_code && NULL != result.msg && '\0' != *(result.msg)) @@ -72,6 +72,6 @@ void zbx_mock_test_entry(void **state) zbx_mock_assert_result_eq("Return value", expected_code, returned_code); - free_result(&result); - free_request(&request); + zbx_free_agent_result(&result); + zbx_free_agent_request(&request); } diff --git a/tests/libs/zbxsysinfo/common/SYSTEM_LOCALTIME.c b/tests/libs/zbxsysinfo/common/SYSTEM_LOCALTIME.c index 4943a789590..e6c6aa5729f 100644 --- a/tests/libs/zbxsysinfo/common/SYSTEM_LOCALTIME.c +++ b/tests/libs/zbxsysinfo/common/SYSTEM_LOCALTIME.c @@ -20,7 +20,7 @@ #include "zbxmocktest.h" #include "zbxmockdata.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxnum.h" #include "../../../../src/libs/zbxsysinfo/common/system.h" @@ -140,10 +140,10 @@ void zbx_mock_test_entry(void **state) zbx_mock_error_string(error)); } - init_request(&request); - init_result(¶m_result); + zbx_init_agent_request(&request); + zbx_init_agent_result(¶m_result); - if (SUCCEED != parse_item_key(key_string, &request)) + if (SUCCEED != zbx_parse_item_key(key_string, &request)) fail_msg("Cannot parse item key from string '%s'", key_string); if (0 != strcmp(request.key, "system.localtime")) @@ -156,9 +156,9 @@ void zbx_mock_test_entry(void **state) } if (SYSINFO_RET_OK == expected_result) - value = (NULL != GET_TEXT_RESULT(¶m_result)) ? *GET_TEXT_RESULT(¶m_result) : NULL; + value = (NULL != ZBX_GET_TEXT_RESULT(¶m_result)) ? *ZBX_GET_TEXT_RESULT(¶m_result) : NULL; else - value = (NULL != GET_MSG_RESULT(¶m_result)) ? *GET_MSG_RESULT(¶m_result) : NULL; + value = (NULL != ZBX_GET_MSG_RESULT(¶m_result)) ? *ZBX_GET_MSG_RESULT(¶m_result) : NULL; if (NULL == value || 0 != strcmp(expected_value_string, value)) { @@ -166,8 +166,8 @@ void zbx_mock_test_entry(void **state) expected_value_string); } - free_request(&request); - free_result(¶m_result); + zbx_free_agent_request(&request); + zbx_free_agent_result(¶m_result); } time_t __wrap_time(time_t *seconds) diff --git a/tests/libs/zbxsysinfo/common/VFS_FILE_EXISTS.c b/tests/libs/zbxsysinfo/common/VFS_FILE_EXISTS.c index 6a90b15951c..ecb26349892 100644 --- a/tests/libs/zbxsysinfo/common/VFS_FILE_EXISTS.c +++ b/tests/libs/zbxsysinfo/common/VFS_FILE_EXISTS.c @@ -22,7 +22,7 @@ #include "zbxmockassert.h" #include "zbxmockutil.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "file.h" #define TEST_NAME "VFS_FILE_EXISTS" @@ -39,10 +39,10 @@ void zbx_mock_test_entry(void **state) key = zbx_mock_get_parameter_string("in.key"); expected_ret = zbx_mock_str_to_return_code(zbx_mock_get_parameter_string("out.result")); - init_request(&request); - init_result(&result); + zbx_init_agent_request(&request); + zbx_init_agent_result(&result); - if (SUCCEED != parse_item_key(key, &request)) + if (SUCCEED != zbx_parse_item_key(key, &request)) fail_msg("Cannot parse item key: %s", key); ret = VFS_FILE_EXISTS(&request, &result); @@ -59,6 +59,6 @@ void zbx_mock_test_entry(void **state) zbx_mock_get_parameter_string("out.error"), result.msg); } - free_result(&result); - free_request(&request); + zbx_free_agent_result(&result); + zbx_free_agent_request(&request); } diff --git a/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c b/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c index 43620c44686..981f1d6efa9 100644 --- a/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c +++ b/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c @@ -22,7 +22,7 @@ #include "zbxmockutil.h" #include "zbxcomms.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "../../../../src/libs/zbxsysinfo/common/http.h" #ifndef HAVE_LIBCURL @@ -73,11 +73,11 @@ void zbx_mock_test_entry(void **state) expected_result = zbx_mock_str_to_return_code(zbx_mock_get_parameter_string("out.return")); - init_request(&request); - init_result(¶m_result); + zbx_init_agent_request(&request); + zbx_init_agent_result(¶m_result); init_param = zbx_mock_get_parameter_string("in.key"); - if (SUCCEED != parse_item_key(init_param, &request)) + if (SUCCEED != zbx_parse_item_key(init_param, &request)) fail_msg("Cannot parse item key: %s", init_param); if (expected_result != (actual_result = WEB_PAGE_GET(&request, ¶m_result))) @@ -89,12 +89,12 @@ void zbx_mock_test_entry(void **state) if (SYSINFO_RET_FAIL == expected_result) { buffer = zbx_mock_get_parameter_string("out.error"); - rvalue = (NULL != GET_MSG_RESULT(¶m_result)) ? *GET_MSG_RESULT(¶m_result) : NULL; + rvalue = (NULL != ZBX_GET_MSG_RESULT(¶m_result)) ? *ZBX_GET_MSG_RESULT(¶m_result) : NULL; } else { buffer = zbx_mock_get_parameter_string(STR_FIELD_OUT); - rvalue = (NULL != GET_TEXT_RESULT(¶m_result)) ? *GET_TEXT_RESULT(¶m_result) : NULL; + rvalue = (NULL != ZBX_GET_TEXT_RESULT(¶m_result)) ? *ZBX_GET_TEXT_RESULT(¶m_result) : NULL; } if (NULL == rvalue) @@ -108,8 +108,8 @@ void zbx_mock_test_entry(void **state) if (0 != strcmp(buffer, rvalue)) fail_msg("Got '%s' instead of '%s' as a value.", rvalue, buffer); - free_request(&request); - free_result(¶m_result); + zbx_free_agent_request(&request); + zbx_free_agent_result(¶m_result); } #ifdef HAVE_LIBCURL diff --git a/tests/libs/zbxsysinfo/linux/KERNEL_COMMON.c b/tests/libs/zbxsysinfo/linux/KERNEL_COMMON.c index a66f82e7652..e1f75cacd16 100644 --- a/tests/libs/zbxsysinfo/linux/KERNEL_COMMON.c +++ b/tests/libs/zbxsysinfo/linux/KERNEL_COMMON.c @@ -21,7 +21,7 @@ #include "zbxmocktest.h" #include "zbxmockdata.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxnum.h" void zbx_mock_test_entry_KERNEL_COMMON(void **state, int kernel_func) @@ -63,8 +63,8 @@ void zbx_mock_test_entry_KERNEL_COMMON(void **state, int kernel_func) fail_msg("Cannot get expected numeric parameter from test case data: %s", expected_param_value_string); } - init_request(&request); - init_result(¶m_result); + zbx_init_agent_request(&request); + zbx_init_agent_result(¶m_result); if (ZABBIX_MOCK_KERNEL_MAXPROC == kernel_func) actual_result = KERNEL_MAXPROC(&request, ¶m_result); @@ -81,28 +81,28 @@ void zbx_mock_test_entry_KERNEL_COMMON(void **state, int kernel_func) if (SYSINFO_RET_OK == expected_result) { - if (NULL == GET_UI64_RESULT(¶m_result)) + if (NULL == ZBX_GET_UI64_RESULT(¶m_result)) fail_msg("Got 'NULL' instead of '%s' as a value.", expected_param_value_string); - if (expected_param_value != *GET_UI64_RESULT(¶m_result)) + if (expected_param_value != *ZBX_GET_UI64_RESULT(¶m_result)) { - fail_msg("Got '" ZBX_FS_UI64 "' instead of '%s' as a value.", *GET_UI64_RESULT(¶m_result), + fail_msg("Got '" ZBX_FS_UI64 "' instead of '%s' as a value.", *ZBX_GET_UI64_RESULT(¶m_result), expected_param_value_string); } } if (SYSINFO_RET_FAIL == expected_result) { - if (NULL == GET_MSG_RESULT(¶m_result) || 0 != strcmp(expected_param_value_string, - *GET_MSG_RESULT(¶m_result))) + if (NULL == ZBX_GET_MSG_RESULT(¶m_result) || 0 != strcmp(expected_param_value_string, + *ZBX_GET_MSG_RESULT(¶m_result))) { fail_msg("Got '%s' instead of '%s' as a value.", - (NULL != GET_MSG_RESULT(¶m_result) ? - *GET_MSG_RESULT(¶m_result) : "NULL"), + (NULL != ZBX_GET_MSG_RESULT(¶m_result) ? + *ZBX_GET_MSG_RESULT(¶m_result) : "NULL"), expected_param_value_string); } } - free_request(&request); - free_result(¶m_result); + zbx_free_agent_request(&request); + zbx_free_agent_result(¶m_result); } diff --git a/tests/libs/zbxsysinfo/linux/NET_IF_COMMON.c b/tests/libs/zbxsysinfo/linux/NET_IF_COMMON.c index 12d7dab5439..4c4570d8612 100644 --- a/tests/libs/zbxsysinfo/linux/NET_IF_COMMON.c +++ b/tests/libs/zbxsysinfo/linux/NET_IF_COMMON.c @@ -21,7 +21,7 @@ #include "zbxmocktest.h" #include "zbxmockdata.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxnum.h" void zbx_mock_test_entry_NET_IF_COMMON(void **state, int net_if_func) @@ -75,10 +75,10 @@ void zbx_mock_test_entry_NET_IF_COMMON(void **state, int net_if_func) } } - init_request(&request); - init_result(¶m_result); + zbx_init_agent_request(&request); + zbx_init_agent_result(¶m_result); - if (SUCCEED != parse_item_key(init_param, &request)) + if (SUCCEED != zbx_parse_item_key(init_param, &request)) fail_msg("Cannot parse item key: %s", init_param); if (ZABBIX_MOCK_NET_IF_IN == net_if_func) @@ -98,12 +98,13 @@ void zbx_mock_test_entry_NET_IF_COMMON(void **state, int net_if_func) if (SYSINFO_RET_OK == expected_result) { - if (NULL == GET_UI64_RESULT(¶m_result) || expected_param_value != *GET_UI64_RESULT(¶m_result)) + if (NULL == ZBX_GET_UI64_RESULT(¶m_result) || expected_param_value != + *ZBX_GET_UI64_RESULT(¶m_result)) { - if (NULL != GET_UI64_RESULT(¶m_result)) + if (NULL != ZBX_GET_UI64_RESULT(¶m_result)) { fail_msg("Got '" ZBX_FS_UI64 "' instead of '%s' as a value.", - *GET_UI64_RESULT(¶m_result), expected_param_value_string); + *ZBX_GET_UI64_RESULT(¶m_result), expected_param_value_string); } else fail_msg("Got 'NULL' instead of '%s' as a value.", expected_param_value_string); @@ -111,16 +112,16 @@ void zbx_mock_test_entry_NET_IF_COMMON(void **state, int net_if_func) } else /* SYSINFO_RET_FAIL == expected_result */ { - if (NULL == GET_MSG_RESULT(¶m_result) || - 0 != strcmp(expected_param_value_string, *GET_MSG_RESULT(¶m_result))) + if (NULL == ZBX_GET_MSG_RESULT(¶m_result) || + 0 != strcmp(expected_param_value_string, *ZBX_GET_MSG_RESULT(¶m_result))) { fail_msg("Got '%s' instead of '%s' as a value.", - (NULL != GET_MSG_RESULT(¶m_result) ? - *GET_MSG_RESULT(¶m_result) : "NULL"), + (NULL != ZBX_GET_MSG_RESULT(¶m_result) ? + *ZBX_GET_MSG_RESULT(¶m_result) : "NULL"), expected_param_value_string); } } - free_request(&request); - free_result(¶m_result); + zbx_free_agent_request(&request); + zbx_free_agent_result(¶m_result); } diff --git a/tests/libs/zbxsysinfo/linux/NET_IF_DISCOVERY.c b/tests/libs/zbxsysinfo/linux/NET_IF_DISCOVERY.c index 928cbb2dbb8..fa728d13c39 100644 --- a/tests/libs/zbxsysinfo/linux/NET_IF_DISCOVERY.c +++ b/tests/libs/zbxsysinfo/linux/NET_IF_DISCOVERY.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #define FAIL_PARAM(NAME, MOCK_ERR) fail_msg("Cannot get \"%s\": %s", NAME, zbx_mock_error_string(MOCK_ERR)) @@ -57,15 +57,15 @@ void zbx_mock_test_entry(void **state) expected_string = expected_json; } - init_request(&request); - init_result(&result); + zbx_init_agent_request(&request); + zbx_init_agent_result(&result); - if (SUCCEED != parse_item_key("net.if.discovery", &request)) - fail_msg("Unexpected return code from parse_item_key()"); + if (SUCCEED != zbx_parse_item_key("net.if.discovery", &request)) + fail_msg("Unexpected return code from zbx_parse_item_key()"); actual_ret = NET_IF_DISCOVERY(&request, &result); - free_request(&request); + zbx_free_agent_request(&request); if (actual_ret != expected_ret) { @@ -75,9 +75,9 @@ void zbx_mock_test_entry(void **state) /* we know the return code is one of these */ if (SYSINFO_RET_OK == actual_ret) - p_result = GET_STR_RESULT(&result); + p_result = ZBX_GET_STR_RESULT(&result); else - p_result = GET_MSG_RESULT(&result); + p_result = ZBX_GET_MSG_RESULT(&result); if (NULL == p_result) fail_msg("NULL result in AGENT_RESULT while expected \"%s\"", expected_string); @@ -87,7 +87,7 @@ void zbx_mock_test_entry(void **state) if (0 != strcmp(expected_string, actual_string)) fail_msg("Unexpected result string: expected \"%s\", got \"%s\"", expected_string, actual_string); - free_result(&result); + zbx_free_agent_result(&result); } /* fails on error, sets *value to NULL if parameter not found */ diff --git a/tests/libs/zbxsysinfo/linux/SYSTEM_BOOTTIME.c b/tests/libs/zbxsysinfo/linux/SYSTEM_BOOTTIME.c index 214af117fff..f46d14ec260 100644 --- a/tests/libs/zbxsysinfo/linux/SYSTEM_BOOTTIME.c +++ b/tests/libs/zbxsysinfo/linux/SYSTEM_BOOTTIME.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" void zbx_mock_test_entry(void **state) { @@ -52,10 +52,10 @@ void zbx_mock_test_entry(void **state) fail_msg("Parameters \"result\" and \"error\" cannot be both present in test case data."); } - init_request(&request); - init_result(&result); + zbx_init_agent_request(&request); + zbx_init_agent_result(&result); - if (SUCCEED != parse_item_key("system.boottime", &request)) + if (SUCCEED != zbx_parse_item_key("system.boottime", &request)) fail_msg("Parsing of \"system.boottime\" key failed."); switch (ret = SYSTEM_BOOTTIME(&request, &result)) @@ -63,7 +63,7 @@ void zbx_mock_test_entry(void **state) case SYSINFO_RET_OK: if (NULL == expected_result) fail_msg("SYSTEM_BOOTTIME() was not expected to succeed."); - if (NULL == (actual_result = GET_TEXT_RESULT(&result))) + if (NULL == (actual_result = ZBX_GET_TEXT_RESULT(&result))) fail_msg("Result is not set."); if (0 != strcmp(*actual_result, expected_result)) fail_msg("Expected result \"%s\" instead of \"%s\".", expected_result, *actual_result); @@ -71,7 +71,7 @@ void zbx_mock_test_entry(void **state) case SYSINFO_RET_FAIL: if (NULL == expected_error) fail_msg("SYSTEM_BOOTTIME() was not expected to fail."); - if (NULL == (actual_error = GET_MSG_RESULT(&result))) + if (NULL == (actual_error = ZBX_GET_MSG_RESULT(&result))) fail_msg("Error message is not set."); if (0 != strcmp(*actual_error, expected_error)) fail_msg("Expected error \"%s\" instead of \"%s\".", expected_error, *actual_error); @@ -80,6 +80,6 @@ void zbx_mock_test_entry(void **state) fail_msg("Unexpected return of SYSTEM_BOOTTIME(): %d (%s).", ret, zbx_sysinfo_ret_string(ret)); } - free_request(&request); - free_result(&result); + zbx_free_agent_request(&request); + zbx_free_agent_result(&result); } diff --git a/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_INTR.c b/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_INTR.c index 56584767e0b..1672a2beb9b 100644 --- a/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_INTR.c +++ b/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_INTR.c @@ -5,7 +5,7 @@ #include "zbxcommon.h" #include "module.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" static int read_yaml_ret(void) { @@ -37,10 +37,10 @@ void zbx_mock_test_entry(void **state) ZBX_UNUSED(state); - init_result(&result); - init_request(&request); + zbx_init_agent_result(&result); + zbx_init_agent_request(&request); - if (SUCCEED != parse_item_key(itemkey, &request)) + if (SUCCEED != zbx_parse_item_key(itemkey, &request)) fail_msg("Invalid item key format '%s'", itemkey); if (read_yaml_ret() != (ret = SYSTEM_CPU_INTR(&request, &result))) @@ -50,15 +50,15 @@ void zbx_mock_test_entry(void **state) { zbx_uint64_t interr; - if (NULL == GET_UI64_RESULT(&result)) + if (NULL == ZBX_GET_UI64_RESULT(&result)) fail_msg("result does not contain numeric unsigned value"); if ((interr = zbx_mock_get_parameter_uint64("out.interrupts_since_boot")) != result.ui64) fail_msg("expected:" ZBX_FS_UI64 " actual:" ZBX_FS_UI64, interr, result.ui64); } - else if (NULL == GET_MSG_RESULT(&result)) + else if (NULL == ZBX_GET_MSG_RESULT(&result)) fail_msg("result does not contain failure message"); - free_request(&request); - free_result(&result); + zbx_free_agent_request(&request); + zbx_free_agent_result(&result); } diff --git a/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_SWITCHES.c b/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_SWITCHES.c index 5d006f44211..f3ab4f79795 100644 --- a/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_SWITCHES.c +++ b/tests/libs/zbxsysinfo/linux/SYSTEM_CPU_SWITCHES.c @@ -20,7 +20,7 @@ #include "zbxmocktest.h" #include "zbxmockdata.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxnum.h" void zbx_mock_test_entry(void **state) @@ -80,8 +80,8 @@ void zbx_mock_test_entry(void **state) } } - init_request(&zbx_agent_request); - init_result(&zbx_agent_result); + zbx_init_agent_request(&zbx_agent_request); + zbx_init_agent_result(&zbx_agent_result); /* call the function-under-test */ actual_ret = SYSTEM_CPU_SWITCHES(&zbx_agent_request, &zbx_agent_result); @@ -98,7 +98,7 @@ void zbx_mock_test_entry(void **state) { zbx_uint64_t *actual_context_switches_count; - if (NULL == (actual_context_switches_count = GET_UI64_RESULT(&zbx_agent_result))) + if (NULL == (actual_context_switches_count = ZBX_GET_UI64_RESULT(&zbx_agent_result))) fail_msg("SYSTEM_CPU_SWITCHES() returned no valid number of context switches in AGENT_RESULT."); if (expected_context_switches_count != *actual_context_switches_count) @@ -111,7 +111,7 @@ void zbx_mock_test_entry(void **state) { char **actual_error_msg; - if (NULL == (actual_error_msg = GET_MSG_RESULT(&zbx_agent_result)) || NULL == *actual_error_msg) + if (NULL == (actual_error_msg = ZBX_GET_MSG_RESULT(&zbx_agent_result)) || NULL == *actual_error_msg) fail_msg("SYSTEM_CPU_SWITCHES() returned no valid error message in AGENT_RESULT."); if (0 != strcmp(expected_error_msg, *actual_error_msg)) @@ -121,6 +121,6 @@ void zbx_mock_test_entry(void **state) } } - free_request(&zbx_agent_request); - free_result(&zbx_agent_result); + zbx_free_agent_request(&zbx_agent_request); + zbx_free_agent_result(&zbx_agent_result); } diff --git a/tests/libs/zbxsysinfo/linux/SYSTEM_HW_CHASSIS.c b/tests/libs/zbxsysinfo/linux/SYSTEM_HW_CHASSIS.c index 3802b04549c..a394c8e61e0 100644 --- a/tests/libs/zbxsysinfo/linux/SYSTEM_HW_CHASSIS.c +++ b/tests/libs/zbxsysinfo/linux/SYSTEM_HW_CHASSIS.c @@ -23,7 +23,7 @@ #include "zbxmockhelper.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" void zbx_mock_test_entry(void **state) { @@ -38,10 +38,10 @@ void zbx_mock_test_entry(void **state) expected_value = zbx_mock_get_parameter_string("out.value"); expected_result = zbx_mock_str_to_return_code(zbx_mock_get_parameter_string("out.return")); - init_request(&request); - init_result(&result); + zbx_init_agent_request(&request); + zbx_init_agent_result(&result); - if (SUCCEED != parse_item_key(param, &request)) + if (SUCCEED != zbx_parse_item_key(param, &request)) fail_msg("Cannot parse item key: %s", param); if (expected_result != (actual_result = SYSTEM_HW_CHASSIS(&request, &result))) @@ -50,21 +50,21 @@ void zbx_mock_test_entry(void **state) zbx_sysinfo_ret_string(expected_result), zbx_sysinfo_ret_string(actual_result)); } - if (SYSINFO_RET_OK == expected_result && 0 == strcmp(expected_value, *GET_STR_RESULT(&result))) + if (SYSINFO_RET_OK == expected_result && 0 == strcmp(expected_value, *ZBX_GET_STR_RESULT(&result))) { - if (NULL == GET_STR_RESULT(&result)) + if (NULL == ZBX_GET_STR_RESULT(&result)) fail_msg("Got 'NULL' instead of '%s' as a value.", expected_value); } else /* SYSINFO_RET_FAIL == expected_result */ { - if (NULL == GET_MSG_RESULT(&result) || 0 != strcmp(expected_value, *GET_MSG_RESULT(&result))) + if (NULL == ZBX_GET_MSG_RESULT(&result) || 0 != strcmp(expected_value, *ZBX_GET_MSG_RESULT(&result))) { fail_msg("Got '%s' instead of '%s' as a value.", - (NULL != GET_MSG_RESULT(&result) ? *GET_MSG_RESULT(&result) : "NULL"), + (NULL != ZBX_GET_MSG_RESULT(&result) ? *ZBX_GET_MSG_RESULT(&result) : "NULL"), expected_value); } } - free_request(&request); - free_result(&result); + zbx_free_agent_request(&request); + zbx_free_agent_result(&result); } diff --git a/tests/libs/zbxsysinfo/linux/VFS_FS_DISCOVERY.c b/tests/libs/zbxsysinfo/linux/VFS_FS_DISCOVERY.c index 6bc2d9a6612..571d521b4d6 100644 --- a/tests/libs/zbxsysinfo/linux/VFS_FS_DISCOVERY.c +++ b/tests/libs/zbxsysinfo/linux/VFS_FS_DISCOVERY.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #define GET_TEST_PARAM_FAIL(NAME, MOCK_ERR) fail_msg("Cannot get \"%s\": %s", NAME, zbx_mock_error_string(MOCK_ERR)) @@ -68,8 +68,8 @@ void zbx_mock_test_entry(void **state) expected_string = expected_json; } - init_request(&request); - init_result(&result); + zbx_init_agent_request(&request); + zbx_init_agent_result(&result); if (expected_result != (actual_result = VFS_FS_DISCOVERY(&request, &result))) { @@ -78,9 +78,9 @@ void zbx_mock_test_entry(void **state) } if (SYSINFO_RET_OK == actual_result) - p_result = GET_STR_RESULT(&result); + p_result = ZBX_GET_STR_RESULT(&result); else - p_result = GET_MSG_RESULT(&result); + p_result = ZBX_GET_MSG_RESULT(&result); if (NULL == p_result) fail_msg("NULL result in AGENT_RESULT while expected \"%s\"", expected_string); @@ -90,6 +90,6 @@ void zbx_mock_test_entry(void **state) if (0 != strcmp(expected_string, actual_string)) fail_msg("Unexpected result string: expected \"%s\", got \"%s\"", expected_string, actual_string); - free_request(&request); - free_result(&result); + zbx_free_agent_request(&request); + zbx_free_agent_result(&result); } diff --git a/tests/libs/zbxsysinfo/parse_item_key.c b/tests/libs/zbxsysinfo/parse_item_key.c index d61fccd888a..302f0e728d6 100644 --- a/tests/libs/zbxsysinfo/parse_item_key.c +++ b/tests/libs/zbxsysinfo/parse_item_key.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxcommon.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" const char *request_parameter_type_to_str(zbx_request_parameter_type_t type); @@ -79,9 +79,9 @@ void zbx_mock_test_entry(void **state) fail_msg("Cannot get expected parameters from test case data: %s", zbx_mock_error_string(error)); } - init_request(&request); + zbx_init_agent_request(&request); - if (expected_result != (actual_result = parse_item_key(item_key, &request))) + if (expected_result != (actual_result = zbx_parse_item_key(item_key, &request))) { fail_msg("Got %s instead of %s as a result.", zbx_result_string(actual_result), zbx_result_string(expected_result)); @@ -129,5 +129,5 @@ void zbx_mock_test_entry(void **state) fail_msg("There are more actual parameters (%d) than expected (%d).", i, request.nparam); } - free_request(&request); + zbx_free_agent_request(&request); } diff --git a/tests/libs/zbxsysinfo/process.c b/tests/libs/zbxsysinfo/zbx_execute_agent_check.c index fe76bdd2921..bf48e3841f4 100644 --- a/tests/libs/zbxsysinfo/process.c +++ b/tests/libs/zbxsysinfo/zbx_execute_agent_check.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "module.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxstr.h" #include "zbxnum.h" #include "zbxalgo.h" @@ -69,9 +69,9 @@ void zbx_mock_test_entry(void **state) if (SUCCEED != zbx_is_uint32(flags_string, &flags_uint32)) fail_msg("Cannot convert flags to unsigned 32 bit integer."); - init_metrics(); + zbx_init_metrics(); - process(in_command_string, flags_uint32, &result); + zbx_execute_agent_check(in_command_string, flags_uint32, &result); if (NULL != (p = strchr(in_command_string, '['))) zbx_strlcpy(key, in_command_string, p - in_command_string + 1); diff --git a/tests/libs/zbxsysinfo/process.yaml b/tests/libs/zbxsysinfo/zbx_execute_agent_check.yaml index 49655beebed..49655beebed 100644 --- a/tests/libs/zbxsysinfo/process.yaml +++ b/tests/libs/zbxsysinfo/zbx_execute_agent_check.yaml diff --git a/tests/libs/zbxsysinfo/process_http.c b/tests/libs/zbxsysinfo/zbx_execute_agent_check_http.c index 86031931656..532e797f911 100644 --- a/tests/libs/zbxsysinfo/process_http.c +++ b/tests/libs/zbxsysinfo/zbx_execute_agent_check_http.c @@ -21,7 +21,7 @@ #include "zbxmockdata.h" #include "zbxdbhigh.h" -#include "sysinfo.h" +#include "zbxsysinfo.h" #include "zbxnum.h" #include "zbxstr.h" @@ -56,9 +56,9 @@ void zbx_mock_test_entry(void **state) if (SUCCEED != zbx_is_uint32(flags_string, &flags_uint32)) fail_msg("Cannot convert flags to unsigned 32 bit integer."); - init_metrics(); + zbx_init_metrics(); - process(in_command_string, flags_uint32, &result); + zbx_execute_agent_check(in_command_string, flags_uint32, &result); if (NULL != (p = strchr(in_command_string, '['))) zbx_strlcpy(key, in_command_string, p - in_command_string + 1); diff --git a/tests/libs/zbxsysinfo/process_http.yaml b/tests/libs/zbxsysinfo/zbx_execute_agent_check_http.yaml index b2fd1b62caf..b2fd1b62caf 100644 --- a/tests/libs/zbxsysinfo/process_http.yaml +++ b/tests/libs/zbxsysinfo/zbx_execute_agent_check_http.yaml diff --git a/tests/zabbix_server/poller/test_get_value_ssh.c b/tests/zabbix_server/poller/test_get_value_ssh.c index 1b5c317757f..2edb9ec0bea 100644 --- a/tests/zabbix_server/poller/test_get_value_ssh.c +++ b/tests/zabbix_server/poller/test_get_value_ssh.c @@ -21,6 +21,8 @@ #include "../../../src/zabbix_server/poller/checks_ssh.h" +#include "zbxsysinfo.h" + int __wrap_ssh_run(DC_ITEM *item, AGENT_RESULT *result, const char *encoding); #if defined(HAVE_SSH2) || defined(HAVE_SSH) @@ -29,7 +31,7 @@ int zbx_get_value_ssh_test_run(DC_ITEM *item, char **error) AGENT_RESULT result; int ret; - init_result(&result); + zbx_init_agent_result(&result); ret = get_value_ssh(item, &result); if (NULL != result.msg && '\0' != *(result.msg)) @@ -38,7 +40,7 @@ int zbx_get_value_ssh_test_run(DC_ITEM *item, char **error) zbx_strlcpy(*error, result.msg, strlen(result.msg) * sizeof(char)); } - free_result(&result); + zbx_free_agent_result(&result); return ret; } diff --git a/tests/zabbix_server/poller/test_get_value_telnet.c b/tests/zabbix_server/poller/test_get_value_telnet.c index 8eed5721d18..8d82cf757ba 100644 --- a/tests/zabbix_server/poller/test_get_value_telnet.c +++ b/tests/zabbix_server/poller/test_get_value_telnet.c @@ -21,6 +21,8 @@ #include "../../../src/zabbix_server/poller/checks_telnet.h" +#include "zbxsysinfo.h" + int __wrap_telnet_run(DC_ITEM *item, AGENT_RESULT *result, const char *encoding); int zbx_get_value_telnet_test_run(DC_ITEM *item, char **error) @@ -28,7 +30,7 @@ int zbx_get_value_telnet_test_run(DC_ITEM *item, char **error) AGENT_RESULT result; int ret; - init_result(&result); + zbx_init_agent_result(&result); ret = get_value_telnet(item, &result); if (NULL != result.msg && '\0' != *(result.msg)) @@ -37,7 +39,7 @@ int zbx_get_value_telnet_test_run(DC_ITEM *item, char **error) zbx_strlcpy(*error, result.msg, strlen(result.msg) * sizeof(char)); } - free_result(&result); + zbx_free_agent_result(&result); return ret; } 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); } diff --git a/tests/zabbix_server/trapper/Makefile.am b/tests/zabbix_server/trapper/Makefile.am index bc96b998a7f..2e2be5b6617 100644 --- a/tests/zabbix_server/trapper/Makefile.am +++ b/tests/zabbix_server/trapper/Makefile.am @@ -54,8 +54,8 @@ zbx_trapper_preproc_test_run_LDFLAGS = @SERVER_LDFLAGS@ \ -Wl,--wrap=DBget_user_by_auth_token \ -Wl,--wrap=zbx_user_init \ -Wl,--wrap=zbx_user_free \ - -Wl,--wrap=init_result \ - -Wl,--wrap=free_result + -Wl,--wrap=zbx_init_agent_result \ + -Wl,--wrap=zbx_free_agent_result zbx_trapper_preproc_test_run_CFLAGS = \ -I@top_srcdir@/tests @LIBXML2_CFLAGS@ diff --git a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c index 3dddaa33981..dcfc386ca96 100644 --- a/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c +++ b/tests/zabbix_server/trapper/zbx_trapper_preproc_test_run.c @@ -38,8 +38,8 @@ int __wrap_DBget_user_by_active_session(const char *sessionid, zbx_user_t *user) int __wrap_DBget_user_by_auth_token(const char *formatted_auth_token_hash, zbx_user_t *user); void __wrap_zbx_user_init(zbx_user_t *user); void __wrap_zbx_user_free(zbx_user_t *user); -void __wrap_init_result(AGENT_RESULT *result); -void __wrap_free_result(AGENT_RESULT *result); +void __wrap_zbx_init_agent_result(AGENT_RESULT *result); +void __wrap_zbx_free_agent_result(AGENT_RESULT *result); int __wrap_zbx_preprocessor_test(unsigned char value_type, const char *value, const zbx_timespec_t *ts, const zbx_vector_ptr_t *steps, zbx_vector_ptr_t *results, zbx_vector_ptr_t *history, @@ -118,12 +118,12 @@ void __wrap_zbx_user_free(zbx_user_t *user) zbx_free(user->username); } -void __wrap_init_result(AGENT_RESULT *result) +void __wrap_zbx_init_agent_result(AGENT_RESULT *result) { ZBX_UNUSED(result); } -void __wrap_free_result(AGENT_RESULT *result) +void __wrap_zbx_free_agent_result(AGENT_RESULT *result) { ZBX_UNUSED(result); } diff --git a/tests/zbxmocktest.c b/tests/zbxmocktest.c index 7385d6e0561..2423769b6da 100644 --- a/tests/zbxmocktest.c +++ b/tests/zbxmocktest.c @@ -45,7 +45,6 @@ int CONFIG_JAVAPOLLER_FORKS = 0; int CONFIG_ESCALATOR_FORKS = 1; int CONFIG_SELFMON_FORKS = 1; int CONFIG_DATASENDER_FORKS = 0; -int CONFIG_HEARTBEAT_FORKS = 0; int CONFIG_COLLECTOR_FORKS = 0; int CONFIG_PASSIVE_FORKS = 0; int CONFIG_ACTIVE_FORKS = 0; |