From 5912398b9723545ecd061650667cbb238be85743 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 13 Jul 2006 23:58:00 +0000 Subject: Major fixes to check_disk. Now should return same data as df git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1452 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/t/check_disk.t | 51 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) (limited to 'plugins/t') diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 70d8415c..66344927 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -52,8 +52,8 @@ if ($free_on_mp1 > $free_on_mp2) { } -$result = NPTest->testCmd( "./check_disk -w 100 -c 100 -p $more_free" ); -cmp_ok( $result->return_code, '==', 0, "At least 100 bytes available on $more_free"); +$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" ); +cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free"); like ( $result->output, $successOutput, "OK output" ); $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); @@ -110,35 +110,28 @@ cmp_ok( $result->return_code, '==', 2, "And reversing arguments should not make - -$result = NPTest->testCmd( - "./check_disk -w 10% -c 15% -p $mountpoint_valid" - ); -cmp_ok( $result->return_code, '==', 3, "Invalid command line options" ); - TODO: { - local $TODO = "-p must come after -w and -c"; - $result = NPTest->testCmd( + local $TODO = "Invalid percent figures"; + $result = NPTest->testCmd( + "./check_disk -w 10% -c 15% -p $mountpoint_valid" + ); + cmp_ok( $result->return_code, '==', 3, "Invalid command line options" ); +} + +$result = NPTest->testCmd( "./check_disk -p $mountpoint_valid -w 10% -c 15%" ); - cmp_ok( $result->return_code, "==", 3, "Invalid options - order unimportant" ); -} +cmp_ok( $result->return_code, "==", 3, "Invalid options: -p must come after thresholds" ); $result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ); # 100% empty cmp_ok( $result->return_code, "==", 2, "100% empty" ); like( $result->output, $failureOutput, "Right output" ); -TODO: { - local $TODO = "Requesting 100GB free is should be critical"; - $result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" ); - cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" ); -} +$result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" ); +cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" ); -TODO: { - local $TODO = "-u GB does not work"; - $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty - cmp_ok( $result->return_code, "==", 2, "100 GB empty" ); -} +$result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty +cmp_ok( $result->return_code, "==", 2, "100 GB empty" ); # Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds @@ -151,17 +144,17 @@ cmp_ok( $result->return_code, '==', 0, "Old syntax: 100% used" ); $result = NPTest->testCmd( "./check_disk 0 100 $mountpoint_valid" ); cmp_ok( $result->return_code, '==', 1, "Old syntax: warn 0% used" ); -$result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" ); -cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); - TODO: { - local $TODO = "Need to properly check input"; + local $TODO = "Invalid values"; + $result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" ); + cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); + $result = NPTest->testCmd( "./check_disk 200 200 $mountpoint_valid" ); cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); -} -$result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); -cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); + $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); + cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); +} $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" ); cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" ); -- cgit v1.2.3-74-g34f1