summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-03-21 13:42:18 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2006-03-21 13:42:18 (GMT)
commit4e157fb8cd6aa5dc93f316bb6d474c8a51f37bfe (patch)
treea7a8e3704629b635807a4543a3c0c995ad8cf3a1
parent971244f9abb14001c8528733d855bbedbbd4bb5e (diff)
downloadmonitoring-plugins-4e157fb8cd6aa5dc93f316bb6d474c8a51f37bfe.tar.gz
Updated to new Test::More method for testing
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1337 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/t/check_load.t17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
index 8f954dc..749dcc1 100644
--- a/plugins/t/check_load.t
+++ b/plugins/t/check_load.t
@@ -6,20 +6,21 @@
6# 6#
7 7
8use strict; 8use strict;
9use Test; 9use Test::More;
10use NPTest; 10use NPTest;
11 11
12use vars qw($tests); 12my $res;
13BEGIN {$tests = 4; plan tests => $tests}
14 13
15my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; 14my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
16my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; 15my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
17 16
18my $t; 17plan tests => 4;
19 18
20$t += checkCmd( "./check_load -w 100,100,100 -c 100,100,100", 0, $successOutput ); 19$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
21$t += checkCmd( "./check_load -w 0,0,0 -c 0,0,0", 2, $failureOutput ); 20cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
21like( $res->output, $successOutput, "Output OK");
22 22
23exit(0) if defined($Test::Harness::VERSION); 23$res = NPTest->testCmd( "./check_load -w 0,0,0 -c 0,0,0" );
24exit($tests - $t); 24cmp_ok( $res->return_code, 'eq', 2, "Load over 0");
25like( $res->output, $failureOutput, "Output OK");
25 26