summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 971244f)
raw | patch | inline | side by side (parent: 971244f)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Tue, 21 Mar 2006 13:42:18 +0000 (13:42 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Tue, 21 Mar 2006 13:42:18 +0000 (13:42 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1337 f882894a-f735-0410-b71e-b25c423dba1c
plugins/t/check_load.t | patch | blob | history |
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
index 8f954dc444f436cd81c3e28de8e9ec80db0f576a..749dcc1e31882fbc4ca0088c6d0b7b12d4a2328a 100644 (file)
--- a/plugins/t/check_load.t
+++ b/plugins/t/check_load.t
#
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");