[Nagiosplug-checkins] nagiosplug/plugins/t check_load.t,1.4,1.5

Ton Voon tonvoon at users.sourceforge.net
Tue Mar 21 08:46:46 CET 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins/t
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17132/plugins/t

Modified Files:
	check_load.t 
Log Message:
Updated to new Test::More method for testing


Index: check_load.t
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_load.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- check_load.t	25 Jul 2005 01:47:14 -0000	1.4
+++ check_load.t	21 Mar 2006 13:42:18 -0000	1.5
@@ -6,20 +6,21 @@
 #
 
 use strict;
-use Test;
+use Test::More;
 use NPTest;
 
-use vars qw($tests);
-BEGIN {$tests = 4; plan tests => $tests}
+my $res;
 
 my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
 my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
 
-my $t;
+plan tests => 4;
 
-$t += checkCmd( "./check_load -w 100,100,100 -c 100,100,100", 0, $successOutput );
-$t += checkCmd( "./check_load -w 0,0,0       -c 0,0,0",       2, $failureOutput );
+$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
+cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
+like( $res->output, $successOutput, "Output OK");
 
-exit(0) if defined($Test::Harness::VERSION);
-exit($tests - $t);
+$res = NPTest->testCmd( "./check_load -w 0,0,0 -c 0,0,0" );
+cmp_ok( $res->return_code, 'eq', 2, "Load over 0");
+like( $res->output, $failureOutput, "Output OK");
 





More information about the Commits mailing list