[Nagios-checkins] nagios/t-tap test_timeperiods.c,1.5,1.6

Ton Voon tonvoon at users.sourceforge.net
Mon Sep 6 08:33:44 UTC 2010


Update of /cvsroot/nagios/nagios/t-tap
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv17571/t-tap

Modified Files:
	test_timeperiods.c 
Log Message:
Added testcases for timeperiod exclusion bugs (Jean Gabes)


Index: test_timeperiods.c
===================================================================
RCS file: /cvsroot/nagios/nagios/t-tap/test_timeperiods.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_timeperiods.c	7 Aug 2010 00:38:47 -0000	1.5
--- test_timeperiods.c	6 Sep 2010 08:33:41 -0000	1.6
***************
*** 311,315 ****
  	int iterations=1000;
  
! 	plan_tests(6031);
  
  	/* reset program variables */
--- 311,315 ----
  	int iterations=1000;
  
! 	plan_tests(6043);
  
  	/* reset program variables */
***************
*** 400,405 ****
--- 400,473 ----
  	}
  
+ 
+ 
  	/* Tests around clock change going back for TZ=Europe/London. 1256511661 = Sun Oct  
  25 23:01:01 2009 */
+ 	/* A little trip to Paris*/
+ 	putenv("TZ=Europe/Paris");
+         tzset();
+ 
+ 
+ 	/* Timeperiod exclude tests, from Jean Gabes */
+ 	temp_timeperiod = find_timeperiod("Test_exclude");
+         ok(temp_timeperiod!=NULL, "ME: Testing Exclude timeperiod");
+ 	test_time=1278939600;
+ 	/* printf("Testing at time %s", ctime(&test_time)); */
+         is_valid_time = check_time_against_period(test_time, temp_timeperiod);
+         ok( is_valid_time==ERROR, "ME: 12 Jul 2010 15:00:00 - false" );
+ 
+         _get_next_valid_time(test_time, test_time, &chosen_valid_time, temp_timeperiod);
+ 	/* printf("JEAN: Got chosent time at %s", ctime(&chosen_valid_time)); */
+ 	todo_start("Bug in exclude");
+         ok( chosen_valid_time==1288103400, "ME: Next valid time=Tue Oct 26 16:30:00 2010");
+ 	todo_end();
+ 
+ 
+ 	temp_timeperiod = find_timeperiod("Test_exclude2");
+         ok(temp_timeperiod!=NULL, "ME: Testing Exclude timeperiod 2");
+ 	test_time=1278939600;
+ 	/* printf("Testing at time %s", ctime(&test_time)); */
+         is_valid_time = check_time_against_period(test_time, temp_timeperiod);
+         ok( is_valid_time==ERROR, "ME: 12 Jul 2010 15:00:00 - false" );
+         _get_next_valid_time(test_time, test_time, &chosen_valid_time, temp_timeperiod);
+ 	/* printf("JEAN: Got chosent time at %s", ctime(&chosen_valid_time)); */
+ 	todo_start("Bug in exclude 2");
+         ok( chosen_valid_time==1279058340, "ME: Next valid time=Tue Jul 13 23:59:00 2010");
+ 	todo_end();
+ 
+ 
+ 	temp_timeperiod = find_timeperiod("Test_exclude3");
+         ok(temp_timeperiod!=NULL, "ME: Testing Exclude timeperiod 3");
+         test_time=1278939600;
+         /* printf("Testing at time %s", ctime(&test_time)); */
+         is_valid_time = check_time_against_period(test_time, temp_timeperiod);
+         ok( is_valid_time==ERROR, "ME: 12 Jul 2010 15:00:00 - false" );
+         _get_next_valid_time(test_time, test_time, &chosen_valid_time, temp_timeperiod);
+         /* printf("JEAN: Got chosent time at %s", ctime(&chosen_valid_time)); */
+ 	todo_start("Bug in exclude 3");
+         ok( chosen_valid_time==1284474600, "ME: Next valid time=Tue Sep 14 16:30:00 2010");
+ 	todo_end();
+ 
+ 
+ 	temp_timeperiod = find_timeperiod("Test_exclude4");
+         ok(temp_timeperiod!=NULL, "ME: Testing Exclude timeperiod 4");
+         test_time=1278939600;
+         /* printf("Testing at time %s", ctime(&test_time)); */
+         is_valid_time = check_time_against_period(test_time, temp_timeperiod);
+         ok( is_valid_time==ERROR, "ME: 12 Jul 2010 15:00:00 - false" );
+         _get_next_valid_time(test_time, test_time, &chosen_valid_time, temp_timeperiod);
+         /* printf("JEAN: Got chosent time at %s", ctime(&chosen_valid_time)); */
+ 	todo_start("Bug in exclude 3");
+         ok( chosen_valid_time==1283265000, "ME: Next valid time=Tue Aug 31 16:30:00 2010");
+ 	todo_end();
+ 
+ 
+ 	
+ 
+ 	/* Back to New york */
+ 	putenv("TZ=America/New_York");
+         tzset();
+ 
+ 
  	temp_timeperiod = find_timeperiod("sunday_only");
  	ok(temp_timeperiod!=NULL, "Testing Sunday 00:00-01:15,03:15-22:00");
***************
*** 407,410 ****
--- 475,479 ----
  	tzset();
  
+ 
  	test_time=1256421000;
  	is_valid_time = check_time_against_period(test_time, temp_timeperiod);
***************
*** 413,416 ****
--- 482,486 ----
  	ok( chosen_valid_time==1256425200, "Next valid time=Sun Oct 25 00:00:00 2009");
  
+ 
  	test_time=1256421661;
  	is_valid_time = check_time_against_period(test_time, temp_timeperiod);





More information about the Nagios-commits mailing list