Code

check_disk now errors if a specified directory does not exist (cf df /foo)
[nagiosplug.git] / plugins / t / check_load.t
1 #! /usr/bin/perl -w -I ..
2 #
3 # Load Average Tests via check_load
4 #
5 # $Id$
6 #
8 use strict;
9 use Test::More;
10 use NPTest;
12 my $res;
14 my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
15 my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
17 plan tests => 4;
19 $res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
20 cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
21 like( $res->output, $successOutput, "Output OK");
23 $res = NPTest->testCmd( "./check_load -w 0,0,0 -c 0,0,0" );
24 cmp_ok( $res->return_code, 'eq', 2, "Load over 0");
25 like( $res->output, $failureOutput, "Output OK");