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 @@ +#! /usr/bin/perl -w -I .. +# +# Disk Space Tests via check_disk +# +# $Id$ +# + use strict; use Test; +use NPTest; + use vars qw($tests); +BEGIN {$tests = 10; plan tests => $tests} + +my $successOutput = '/^DISK OK - /'; +my $failureOutput = '/^DISK CRITICAL - /'; + +my $mountpoint_valid = getTestParameter( "mountpoint_valid", "NP_MOUNTPOINT_VALID", "/", + "The path to a valid mountpoint" ); -BEGIN {$tests = 6; plan tests => $tests} +my $mountpoint_invalid = getTestParameter( "mountpoint_invalid", "NP_MOUNTPOINT_INVALID", "/missing", + "The path to a invalid (non-existent) mountpoint" ); -my $null = ''; -my $cmd; -my $str; my $t; -$cmd = "./check_disk 100 100 /"; -$str = `$cmd`; -$t += ok $?>>8,0; -print "Test was: $cmd\n" if ($?); -$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/'; - -$cmd = "./check_disk -w 0 -c 0 /"; -$str = `$cmd`; -$t += ok $?>>8,0; -print "Test was: $cmd\n" if ($?); -$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/'; - -$cmd = "./check_disk 0 0 /"; -$str = `$cmd`; -$t += ok $?>>8,2; -print "Test was: $cmd\n" unless ($?); -$t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/'; +$t += checkCmd( "./check_disk 100 100 ${mountpoint_valid}", 0, $successOutput ); +$t += checkCmd( "./check_disk -w 0 -c 0 ${mountpoint_valid}", 0, $successOutput ); +$t += checkCmd( "./check_disk -w 1\% -c 1\% ${mountpoint_valid}", 0, $successOutput ); +$t += checkCmd( "./check_disk 0 0 ${mountpoint_valid}", 2, $failureOutput ); +$t += checkCmd( "./check_disk 100 100 ${mountpoint_invalid}", 2, '/not found/' ); exit(0) if defined($Test::Harness::VERSION); exit($tests - $t); |