diff options
author | Peter Bray <illumino@users.sourceforge.net> | 2005-07-25 01:47:15 +0000 |
---|---|---|
committer | Peter Bray <illumino@users.sourceforge.net> | 2005-07-25 01:47:15 +0000 |
commit | cdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1 (patch) | |
tree | 62b074eaca618762fb03f94708ec3def50037697 /plugins/t/check_disk.t | |
parent | 05853f47eb6e608de993cc59343c73b96b9b33e2 (diff) | |
download | monitoring-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.t | 44 |
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 | |||
1 | use strict; | 8 | use strict; |
2 | use Test; | 9 | use Test; |
10 | use NPTest; | ||
11 | |||
3 | use vars qw($tests); | 12 | use vars qw($tests); |
13 | BEGIN {$tests = 10; plan tests => $tests} | ||
14 | |||
15 | my $successOutput = '/^DISK OK - /'; | ||
16 | my $failureOutput = '/^DISK CRITICAL - /'; | ||
17 | |||
18 | my $mountpoint_valid = getTestParameter( "mountpoint_valid", "NP_MOUNTPOINT_VALID", "/", | ||
19 | "The path to a valid mountpoint" ); | ||
4 | 20 | ||
5 | BEGIN {$tests = 6; plan tests => $tests} | 21 | my $mountpoint_invalid = getTestParameter( "mountpoint_invalid", "NP_MOUNTPOINT_INVALID", "/missing", |
22 | "The path to a invalid (non-existent) mountpoint" ); | ||
6 | 23 | ||
7 | my $null = ''; | ||
8 | my $cmd; | ||
9 | my $str; | ||
10 | my $t; | 24 | my $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 ); |
15 | print "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; | ||
21 | print "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; | ||
27 | print "Test was: $cmd\n" unless ($?); | ||
28 | $t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/'; | ||
29 | 31 | ||
30 | exit(0) if defined($Test::Harness::VERSION); | 32 | exit(0) if defined($Test::Harness::VERSION); |
31 | exit($tests - $t); | 33 | exit($tests - $t); |