[Nagiosplug-checkins] nagiosplug/plugins/t check_disk.t,1.10,1.11

Ton Voon tonvoon at users.sourceforge.net
Fri Jul 14 01:58:02 CEST 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins/t
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20967/plugins/t

Modified Files:
	check_disk.t 
Log Message:
Major fixes to check_disk. Now should return same data as df


Index: check_disk.t
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_disk.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- check_disk.t	12 Jul 2006 22:53:27 -0000	1.10
+++ check_disk.t	13 Jul 2006 23:58:00 -0000	1.11
@@ -52,8 +52,8 @@
 }
 
 
-$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 @@
 
 
 
-
-$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 @@
 $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" );





More information about the Commits mailing list