diff options
Diffstat (limited to 'tests/zabbix_server/escalator')
-rw-r--r-- | tests/zabbix_server/escalator/Makefile.am | 74 | ||||
-rw-r--r-- | tests/zabbix_server/escalator/process_escalations.c | 65 | ||||
-rw-r--r-- | tests/zabbix_server/escalator/process_escalations.json | 40 |
3 files changed, 0 insertions, 179 deletions
diff --git a/tests/zabbix_server/escalator/Makefile.am b/tests/zabbix_server/escalator/Makefile.am deleted file mode 100644 index 41fa50ccce7..00000000000 --- a/tests/zabbix_server/escalator/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -noinst_PROGRAMS = process_escalations - -process_escalations_SOURCES = \ - process_escalations.json \ - process_escalations.c \ - ../../../src/zabbix_server/actions.c \ - ../../../src/zabbix_server/events.c \ - ../../../src/zabbix_server/operations.c \ - ../../zbxmocktest.c \ - ../../zbxmocktest.h - -process_escalations_LDADD = \ - $(top_srcdir)/src/zabbix_server/escalator/libzbxescalator.a \ - $(top_srcdir)/src/zabbix_server/scripts/libzbxscripts.a \ - $(top_srcdir)/src/zabbix_server/poller/libzbxpoller.a \ - $(top_srcdir)/src/zabbix_server/alerter/libzbxalerter.a \ - $(top_srcdir)/src/zabbix_server/dbsyncer/libzbxdbsyncer.a \ - $(top_srcdir)/src/zabbix_server/dbconfig/libzbxdbconfig.a \ - $(top_srcdir)/src/zabbix_server/discoverer/libzbxdiscoverer.a \ - $(top_srcdir)/src/zabbix_server/pinger/libzbxpinger.a \ - $(top_srcdir)/src/zabbix_server/poller/libzbxpoller.a \ - $(top_srcdir)/src/zabbix_server/housekeeper/libzbxhousekeeper.a \ - $(top_srcdir)/src/zabbix_server/timer/libzbxtimer.a \ - $(top_srcdir)/src/zabbix_server/trapper/libzbxtrapper.a \ - $(top_srcdir)/src/zabbix_server/snmptrapper/libzbxsnmptrapper.a \ - $(top_srcdir)/src/zabbix_server/httppoller/libzbxhttppoller.a \ - $(top_srcdir)/src/zabbix_server/escalator/libzbxescalator.a \ - $(top_srcdir)/src/zabbix_server/proxypoller/libzbxproxypoller.a \ - $(top_srcdir)/src/zabbix_server/selfmon/libzbxselfmon.a \ - $(top_srcdir)/src/zabbix_server/vmware/libzbxvmware.a \ - $(top_srcdir)/src/zabbix_server/taskmanager/libzbxtaskmanager.a \ - $(top_srcdir)/src/zabbix_server/ipmi/libipmi.a \ - $(top_srcdir)/src/zabbix_server/odbc/libzbxodbc.a \ - $(top_srcdir)/src/zabbix_server/scripts/libzbxscripts.a \ - $(top_srcdir)/src/zabbix_server/preprocessor/libpreprocessor.a \ - $(top_srcdir)/src/libs/zbxsysinfo/libzbxserversysinfo.a \ - $(top_srcdir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \ - $(top_srcdir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \ - $(top_srcdir)/src/libs/zbxlog/libzbxlog.a \ - $(top_srcdir)/src/libs/zbxserver/libzbxserver.a \ - $(top_srcdir)/src/libs/zbxdbcache/libzbxdbcache.a \ - $(top_srcdir)/src/libs/zbxmemory/libzbxmemory.a \ - $(top_srcdir)/src/libs/zbxregexp/libzbxregexp.a \ - $(top_srcdir)/src/libs/zbxself/libzbxself.a \ - $(top_srcdir)/src/libs/zbxnix/libzbxnix.a \ - $(top_srcdir)/src/libs/zbxalgo/libzbxalgo.a \ - $(top_srcdir)/src/libs/zbxsys/libzbxsys.a \ - $(top_srcdir)/src/libs/zbxconf/libzbxconf.a \ - $(top_srcdir)/src/libs/zbxmedia/libzbxmedia.a \ - $(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \ - $(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \ - $(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \ - $(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \ - $(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \ - $(top_srcdir)/src/libs/zbxcommshigh/libzbxcommshigh.a \ - $(top_srcdir)/src/libs/zbxjson/libzbxjson.a \ - $(top_srcdir)/src/libs/zbxhttp/libzbxhttp.a \ - $(top_srcdir)/src/libs/zbxipcservice/libzbxipcservice.a \ - $(top_srcdir)/src/libs/zbxexec/libzbxexec.a \ - $(top_srcdir)/src/libs/zbxicmpping/libzbxicmpping.a \ - $(top_srcdir)/src/libs/zbxdbupgrade/libzbxdbupgrade.a \ - $(top_srcdir)/src/libs/zbxdbhigh/libzbxdbhigh.a \ - $(top_srcdir)/src/libs/zbxdb/libzbxdb.a \ - $(top_srcdir)/src/libs/zbxmodules/libzbxmodules.a \ - $(top_srcdir)/src/libs/zbxtasks/libzbxtasks.a \ - $(top_srcdir)/tests/libzbxmockdata.a - -process_escalations_LDADD += @SERVER_LIBS@ - -process_escalations_LDFLAGS = \ - -Wl,--wrap=substitute_simple_macros \ - -Wl,--wrap=check_action_condition - -process_escalations_CFLAGS = -I@top_srcdir@/tests diff --git a/tests/zabbix_server/escalator/process_escalations.c b/tests/zabbix_server/escalator/process_escalations.c deleted file mode 100644 index fd5d8317126..00000000000 --- a/tests/zabbix_server/escalator/process_escalations.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Zabbix -** Copyright (C) 2001-2017 Zabbix SIA -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -**/ - -#include "../../zbxtests.h" - -#include "zbxmocktest.h" - -#include "../../../src/zabbix_server/escalator/escalator.h" - -/* make sure that mock functions match unwrapped prototypes */ - -#define substitute_simple_macros __wrap_substitute_simple_macros -#define check_action_condition __wrap_check_action_condition - -#include "zbxserver.h" -#include "../../../src/zabbix_server/actions.h" - -int __wrap_substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, const DB_EVENT *r_event, - zbx_uint64_t *userid, const zbx_uint64_t *hostid, const DC_HOST *dc_host, DC_ITEM *dc_item, - DB_ALERT *alert, const DB_ACKNOWLEDGE *ack, char **data, int macro_type, char *error, int maxerrlen) -{ - return SUCCEED; -} - -int __wrap_check_action_condition(const DB_EVENT *event, DB_CONDITION *condition) -{ - return SUCCEED; -} - -void zbx_mock_test_entry(void **state) -{ - int c, ret, param1, param2, param3; - - for (c = 0; c < case_num; c++) - { - if (0 == strcmp(cases[c].tested_function, "process_escalations")) - { - will_return_always(get_case_name, cases[c].case_name); - - param1 = atoi(cases[c].in_params.values[0]); - param2 = atoi(cases[c].in_params.values[1]); - param3 = atoi(cases[c].in_params.values[2]); - - ret = process_escalations(param1, ¶m2, (unsigned int) param3); - - assert_int_equal(ret, atoi(cases[c].out_params.values[0])); - } - } -} diff --git a/tests/zabbix_server/escalator/process_escalations.json b/tests/zabbix_server/escalator/process_escalations.json deleted file mode 100644 index 48cd0043321..00000000000 --- a/tests/zabbix_server/escalator/process_escalations.json +++ /dev/null @@ -1,40 +0,0 @@ -[ - { - "test_case": "case_1", - "in": { - "names": ["now", "nextcheck", "escalation_source"], - "values": [1504082776, 1504082776, 2] - }, - "out": { - "names": ["return"], - "values": [1] - }, - "db_data": { - "escalations": { - "fields": [ - "escalationid", "actionid", "triggerid", "eventid", "r_eventid", "nextcheck", "esc_step", "status", "itemid", "acknowledgeid" - ], - "rows": [ - [1, 1, 1, 1, 0, 1501594532, 0, 0, 1, 0] - ] - }, - "actions": { - "fields": [ - "actionid", "name", "status", "eventsource", "esc_period", "def_shortdata", "def_longdata", "r_shortdata", "r_longdata", "maintenance_mode", "ack_shortdata", "ack_longdata" - ], - "rows": [ - [1, "action name", 0, 0, "60s", "msg subject", "msg subject", "msg body", 0, "ack subject", "ack body"], - [2, "action name", 0, 0, "60s", "msg subject", "msg subject", "msg body", 0, "ack subject", "ack body"] - ] - } - }, - "functions": { - "DCconfig_get_triggers_by_triggerids": { - "out": { - "params": ["triggerid", "status"], - "values": [1, 0] - } - } - } - } -] |