summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_disk.t
diff options
context:
space:
mode:
authorMatthias Eble <psychotrahe@users.sourceforge.net>2007-05-09 08:16:44 (GMT)
committerMatthias Eble <psychotrahe@users.sourceforge.net>2007-05-09 08:16:44 (GMT)
commitc3c75a0980824f71351ee1efee9634551b0f0bc1 (patch)
tree45cd650cdaac165300c6a5b4835dd75923e2ddd0 /plugins/t/check_disk.t
parent9a3e7f9e8778c845c8752af657364928081f5220 (diff)
downloadmonitoring-plugins-c3c75a0980824f71351ee1efee9634551b0f0bc1.tar.gz
added testcase to verify that old positional arguments only select one path
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1707 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r--plugins/t/check_disk.t5
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index 2ec6cab..5c6aa39 100644
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
@@ -24,7 +24,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth
24if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { 24if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
25 plan skip_all => "Need 2 mountpoints to test"; 25 plan skip_all => "Need 2 mountpoints to test";
26} else { 26} else {
27 plan tests => 68; 27 plan tests => 69;
28} 28}
29 29
30$result = NPTest->testCmd( 30$result = NPTest->testCmd(
@@ -114,10 +114,8 @@ like ( $result->only_output, qr/$more_free/, "Have disk name in text");
114$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" ); 114$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" );
115cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free"); 115cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free");
116$_ = $result->output; 116$_ = $result->output;
117print $result->output."\n";
118my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+) MB .* (\d+) MB /g); 117my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+) MB .* (\d+) MB /g);
119my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; 118my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2;
120print "$free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2\n";
121 119
122 120
123 121
@@ -255,6 +253,7 @@ cmp_ok( $result->return_code, "==", 2, "100 GB empty" );
255# Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds 253# Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds
256$result = NPTest->testCmd( "./check_disk 0 0 ".${mountpoint_valid} ); 254$result = NPTest->testCmd( "./check_disk 0 0 ".${mountpoint_valid} );
257cmp_ok( $result->return_code, "==", 2, "Old syntax: 0% used"); 255cmp_ok( $result->return_code, "==", 2, "Old syntax: 0% used");
256like ( $result->only_output, qr(^[^;]*;[^;]*$), "Select only one path with positional arguments");
258 257
259$result = NPTest->testCmd( "./check_disk 100 100 $mountpoint_valid" ); 258$result = NPTest->testCmd( "./check_disk 100 100 $mountpoint_valid" );
260cmp_ok( $result->return_code, '==', 0, "Old syntax: 100% used" ); 259cmp_ok( $result->return_code, '==', 0, "Old syntax: 100% used" );