[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: fix tests in t-tap

git at icinga.org git at icinga.org
Mon Feb 13 18:19:16 CET 2012


Module: icinga-core
Branch: mfriedrich/core
Commit: 1e886e3d030456ea525798c408a2a202e2369543
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=1e886e3d030456ea525798c408a2a202e2369543

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Mon Feb 13 18:18:42 2012 +0100

fix tests in t-tap

* various variable stubs were missing (stalking notifications, ack with expiry)
* various function stubs were missing (ack with expiry)
* cgiutils.c should be main src for variables (readlogs.c must use extern!), keeping the list of to-be-added-vars to test_xsddefault.c small
* cgi/Makefile.in and t-tap/Makefile.in should be aware of make changes to each other (readlogs.o was missing, preventing clean builds)

* if you *ever* change the building structure, make sure tests run fine!

---

 cgi/cgiutils.c             |    6 +++---
 cgi/readlogs.c             |    6 +++---
 t-tap/Makefile.in          |    3 ++-
 t-tap/stub_broker.c        |    2 +-
 t-tap/test-stubs.c         |    8 ++++++++
 t-tap/test_events.c        |    6 ++++++
 t-tap/test_icinga_config.c |    7 +++++++
 t-tap/test_timeperiods.c   |    6 ++++++
 t-tap/test_xsddefault.c    |    6 ++----
 9 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index 33b4909..10cc6e6 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -96,9 +96,9 @@ extern char 	*macro_user[MAX_USER_MACROS];
 
 /** readlogs.c **/
 int		log_rotation_method = LOG_ROTATION_NONE;
-extern time_t	this_scheduled_log_rotation;
-extern time_t	last_scheduled_log_rotation;
-extern time_t	next_scheduled_log_rotation;
+time_t	this_scheduled_log_rotation;
+time_t	last_scheduled_log_rotation;
+time_t	next_scheduled_log_rotation;
 char		log_file[MAX_INPUT_BUFFER];
 char		log_archive_path[MAX_INPUT_BUFFER];
 
diff --git a/cgi/readlogs.c b/cgi/readlogs.c
index 711eded..c279146 100644
--- a/cgi/readlogs.c
+++ b/cgi/readlogs.c
@@ -48,9 +48,9 @@ extern char	log_archive_path[MAX_FILENAME_LENGTH];	/**< the full path to the arc
 
 /** @name vars for log archive determination
     @{ **/
-time_t		this_scheduled_log_rotation = 0L;		/**< timestamp of current log rotation*/
-time_t		last_scheduled_log_rotation = 0L;		/**< timestamp of last log rotation */
-time_t		next_scheduled_log_rotation = 0L;		/**< timestamp of next log rotation */
+extern time_t		this_scheduled_log_rotation = 0L;		/**< timestamp of current log rotation*/
+extern time_t		last_scheduled_log_rotation = 0L;		/**< timestamp of last log rotation */
+extern time_t		next_scheduled_log_rotation = 0L;		/**< timestamp of next log rotation */
 /** @} */
 
 
diff --git a/t-tap/Makefile.in b/t-tap/Makefile.in
index 1701595..7dfbb06 100644
--- a/t-tap/Makefile.in
+++ b/t-tap/Makefile.in
@@ -19,10 +19,11 @@ TESTS += test_strtoul
 TESTS += test_commands
 TESTS += test_downtime
 
+# these objects must be the same as defined in cgi/Makefile.in as CGILIBS!
 XSD_OBJS = $(SRC_CGI)/statusdata-cgi.o $(SRC_CGI)/xstatusdata-cgi.o
 XSD_OBJS += $(SRC_CGI)/objects-cgi.o $(SRC_CGI)/xobjects-cgi.o
 XSD_OBJS += $(SRC_CGI)/comments-cgi.o $(SRC_CGI)/downtime-cgi.o
-XSD_OBJS += $(SRC_CGI)/cgiutils.o $(SRC_CGI)/skiplist.o ../common/shared.o
+XSD_OBJS += $(SRC_COMMON)/shared.o $(SRC_CGI)/getcgi.o $(SRC_CGI)/cgiutils.o $(SRC_CGI)/cgiauth.o $(SRC_CGI)/readlogs.o $(SRC_CGI)/macros-cgi.o  $(SRC_CGI)/skiplist.o
 
 TP_OBJS = $(SRC_BASE)/utils.o $(SRC_BASE)/config.o $(SRC_BASE)/macros-base.o
 TP_OBJS += $(SRC_BASE)/objects-base.o $(SRC_BASE)/xobjects-base.o
diff --git a/t-tap/stub_broker.c b/t-tap/stub_broker.c
index f148995..eb08c8c 100644
--- a/t-tap/stub_broker.c
+++ b/t-tap/stub_broker.c
@@ -6,4 +6,4 @@ void broker_adaptive_service_data(int type, int flags, int attr, service *svc, i
 void broker_adaptive_contact_data(int type, int flags, int attr, contact *cntct, int command_type, unsigned long modattr, unsigned long modattrs, unsigned long modhattr, unsigned long modhattrs, unsigned long modsattr, unsigned long modsattrs, struct timeval *timestamp) {}
 void broker_external_command(int type, int flags, int attr, int command_type, time_t entry_time, char *command_string, char *command_args, struct timeval *timestamp) {}
 void broker_acknowledgement_data(int type, int flags, int attr, int acknowledgement_type, void *data, char *ack_author, char *ack_data, int subtype, int notify_contacts, int persistent_comment, struct timeval *timestamp) {}
-
+void broker_acknowledgement_data_expire(int type, int flags, int attr, int acknowledgement_type, void *data, char *ack_author, char *ack_data, int subtype, int notify_contacts, int persistent_comment, time_t end_time, struct timeval *timestamp) {}
diff --git a/t-tap/test-stubs.c b/t-tap/test-stubs.c
index 7b70472..588a1dc 100644
--- a/t-tap/test-stubs.c
+++ b/t-tap/test-stubs.c
@@ -119,6 +119,11 @@ int use_syslog_local_facility;
 int syslog_local_facility;
 int log_current_states;
 int log_long_plugin_output;
+int dump_retained_host_service_states_to_neb = TRUE;
+int stalking_notifications_for_hosts = DEFAULT_STALKING_NOTIFICATIONS_FOR_HOSTS;
+int stalking_notifications_for_services = DEFAULT_STALKING_NOTIFICATIONS_FOR_SERVICES;
+
+time_t last_program_stop = 0L;
 
 int grab_host_macros(host *hst) {}
 int grab_host_macros_r(icinga_macros *mac, host *hst) {}
@@ -219,6 +224,9 @@ void 	profiler_update(int event, struct timeval start) {}
 
 int has_shell_metachars(const char *s) {}
 
+void remove_host_acknowledgement(host * hst) {}
+void remove_service_acknowledgement(service * svc) {}
+
 
 /* Icinga CGIs */
 char alert_message;
diff --git a/t-tap/test_events.c b/t-tap/test_events.c
index 4ebf581..fa39eaf 100644
--- a/t-tap/test_events.c
+++ b/t-tap/test_events.c
@@ -147,6 +147,12 @@ int update_host_status(host *hst, int aggregated_dump) {}
 int     event_profiling_enabled = FALSE;
 void    profiler_update(int event, struct timeval start) {}
 
+void remove_host_acknowledgement(host * hst) {}
+void remove_service_acknowledgement(service * svc) {}
+
+int dump_retained_host_service_states_to_neb = TRUE;
+int stalking_notifications_for_hosts = DEFAULT_STALKING_NOTIFICATIONS_FOR_HOSTS;
+int stalking_notifications_for_services = DEFAULT_STALKING_NOTIFICATIONS_FOR_SERVICES;
 
 /* Test variables */
 service *svc1 = NULL, *svc2 = NULL, *svc3 = NULL;
diff --git a/t-tap/test_icinga_config.c b/t-tap/test_icinga_config.c
index 8220959..ae38b2f 100644
--- a/t-tap/test_icinga_config.c
+++ b/t-tap/test_icinga_config.c
@@ -268,6 +268,11 @@ int             service_check_timeout_state = STATE_CRITICAL;
 int             stalking_event_handlers_for_hosts = DEFAULT_STALKING_EVENT_HANDLERS_FOR_HOSTS;
 int             stalking_event_handlers_for_services = DEFAULT_STALKING_EVENT_HANDLERS_FOR_SERVICES;
 
+int dump_retained_host_service_states_to_neb = TRUE;
+int stalking_notifications_for_hosts = DEFAULT_STALKING_NOTIFICATIONS_FOR_HOSTS;
+int stalking_notifications_for_services = DEFAULT_STALKING_NOTIFICATIONS_FOR_SERVICES;
+
+time_t          last_program_stop = 0L;
 
 /* Dummy variables */
 sched_info scheduling_info;
@@ -317,6 +322,8 @@ int service_notification(service *svc, int type, char *not_author, char *not_dat
 int     event_profiling_enabled = FALSE;
 void    profiler_update(int event, struct timeval start) {}
 
+void remove_host_acknowledgement(host * hst) {}
+void remove_service_acknowledgement(service * svc) {}
 
 int main(int argc, char **argv) {
 	int result;
diff --git a/t-tap/test_timeperiods.c b/t-tap/test_timeperiods.c
index 6daa1bf..62db941 100644
--- a/t-tap/test_timeperiods.c
+++ b/t-tap/test_timeperiods.c
@@ -272,6 +272,10 @@ int             service_check_timeout_state = STATE_CRITICAL;
 int             stalking_event_handlers_for_hosts = DEFAULT_STALKING_EVENT_HANDLERS_FOR_HOSTS;
 int             stalking_event_handlers_for_services = DEFAULT_STALKING_EVENT_HANDLERS_FOR_SERVICES;
 
+int dump_retained_host_service_states_to_neb = TRUE;
+int stalking_notifications_for_hosts = DEFAULT_STALKING_NOTIFICATIONS_FOR_HOSTS;
+int stalking_notifications_for_services = DEFAULT_STALKING_NOTIFICATIONS_FOR_SERVICES;
+
 /* Dummy variables */
 sched_info scheduling_info;
 timed_event event_list_low;
@@ -302,6 +306,8 @@ int neb_free_module_list(void) {}
 int     event_profiling_enabled = FALSE;
 void    profiler_update(int event, struct timeval start) {}
 
+void remove_host_acknowledgement(host * hst) {}
+void remove_service_acknowledgement(service * svc) {}
 
 int main(int argc, char **argv) {
 	int result;
diff --git a/t-tap/test_xsddefault.c b/t-tap/test_xsddefault.c
index dd1d474..e4b7bb5 100644
--- a/t-tap/test_xsddefault.c
+++ b/t-tap/test_xsddefault.c
@@ -50,7 +50,7 @@ extern scheduled_downtime *scheduled_downtime_list;
 void profile_object_update_count(char * name, int val) {}
 void profile_object_update_elapsed(char * name, double val) {}
 
-/* Icinga cgiutils.c special */
+/* Icinga cgiutils.c special (extern!) */
 char alert_message;
 char *host_name;
 char *host_filter;
@@ -67,11 +67,9 @@ int overview_columns;
 int max_grid_width;
 int group_style_type;
 int navbar_search;
-void get_log_archive_to_use(int archive, char *file_name, int file_name_length) {}
-time_t last_scheduled_log_rotation = 0L;
-time_t this_scheduled_log_rotation = 0L;
 int CGI_ID;
 
+
 int main(int argc, char **argv) {
 	int result;
 	int c;





More information about the icinga-checkins mailing list