summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_disk.t
diff options
context:
space:
mode:
authorPeter Bray <illumino@users.sourceforge.net>2005-07-25 01:47:15 +0000
committerPeter Bray <illumino@users.sourceforge.net>2005-07-25 01:47:15 +0000
commitcdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1 (patch)
tree62b074eaca618762fb03f94708ec3def50037697 /plugins/t/check_disk.t
parent05853f47eb6e608de993cc59343c73b96b9b33e2 (diff)
downloadmonitoring-plugins-cdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1.tar.gz
[1185704] New Testing Infrastructure.
Complete rewrite of the original testing infrastructure and all test cases (to use the new infrastructure) See NPTest.pm and issue 1185704 for more details. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1207 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r--plugins/t/check_disk.t44
1 files changed, 23 insertions, 21 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index f1e436dc..f2427fbe 100644
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
@@ -1,31 +1,33 @@
1#! /usr/bin/perl -w -I ..
2#
3# Disk Space Tests via check_disk
4#
5# $Id$
6#
7
1use strict; 8use strict;
2use Test; 9use Test;
10use NPTest;
11
3use vars qw($tests); 12use vars qw($tests);
13BEGIN {$tests = 10; plan tests => $tests}
14
15my $successOutput = '/^DISK OK - /';
16my $failureOutput = '/^DISK CRITICAL - /';
17
18my $mountpoint_valid = getTestParameter( "mountpoint_valid", "NP_MOUNTPOINT_VALID", "/",
19 "The path to a valid mountpoint" );
4 20
5BEGIN {$tests = 6; plan tests => $tests} 21my $mountpoint_invalid = getTestParameter( "mountpoint_invalid", "NP_MOUNTPOINT_INVALID", "/missing",
22 "The path to a invalid (non-existent) mountpoint" );
6 23
7my $null = '';
8my $cmd;
9my $str;
10my $t; 24my $t;
11 25
12$cmd = "./check_disk 100 100 /"; 26$t += checkCmd( "./check_disk 100 100 ${mountpoint_valid}", 0, $successOutput );
13$str = `$cmd`; 27$t += checkCmd( "./check_disk -w 0 -c 0 ${mountpoint_valid}", 0, $successOutput );
14$t += ok $?>>8,0; 28$t += checkCmd( "./check_disk -w 1\% -c 1\% ${mountpoint_valid}", 0, $successOutput );
15print "Test was: $cmd\n" if ($?); 29$t += checkCmd( "./check_disk 0 0 ${mountpoint_valid}", 2, $failureOutput );
16$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/'; 30$t += checkCmd( "./check_disk 100 100 ${mountpoint_invalid}", 2, '/not found/' );
17
18$cmd = "./check_disk -w 0 -c 0 /";
19$str = `$cmd`;
20$t += ok $?>>8,0;
21print "Test was: $cmd\n" if ($?);
22$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
23
24$cmd = "./check_disk 0 0 /";
25$str = `$cmd`;
26$t += ok $?>>8,2;
27print "Test was: $cmd\n" unless ($?);
28$t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/';
29 31
30exit(0) if defined($Test::Harness::VERSION); 32exit(0) if defined($Test::Harness::VERSION);
31exit($tests - $t); 33exit($tests - $t);