summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_disk.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r--plugins/t/check_disk.t31
1 files changed, 29 insertions, 2 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index 4f5c4bc4..99c434ac 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 => 69; 27 plan tests => 78;
28} 28}
29 29
30$result = NPTest->testCmd( 30$result = NPTest->testCmd(
@@ -284,9 +284,15 @@ $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /etc" );
284cmp_ok( $result->return_code, '==', 0, "Checking /etc - should return info for /" ); 284cmp_ok( $result->return_code, '==', 0, "Checking /etc - should return info for /" );
285cmp_ok( $result->output, 'eq', $root_output, "check_disk /etc gives same as check_disk /"); 285cmp_ok( $result->output, 'eq', $root_output, "check_disk /etc gives same as check_disk /");
286 286
287$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /etc -E" ); 287$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -E -p /etc " );
288cmp_ok( $result->return_code, '==', 2, "... unless -E/--exact-match is specified"); 288cmp_ok( $result->return_code, '==', 2, "... unless -E/--exact-match is specified");
289 289
290$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /etc -E " );
291cmp_ok( $result->return_code, '==', 3, "-E/--exact-match must be specified before -p");
292
293$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -r /etc -E " );
294cmp_ok( $result->return_code, '==', 3, "-E/--exact-match must be specified before -r");
295
290$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p / -p /bob" ); 296$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p / -p /bob" );
291cmp_ok( $result->return_code, '==', 2, "Checking / and /bob gives critical"); 297cmp_ok( $result->return_code, '==', 2, "Checking / and /bob gives critical");
292unlike( $result->perf_output, '/\/bob/', "perf data does not have /bob in it"); 298unlike( $result->perf_output, '/\/bob/', "perf data does not have /bob in it");
@@ -318,3 +324,24 @@ cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after grou
318$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" ); 324$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" );
319cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable"); 325cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable");
320 326
327# ignore: exit unknown, if all pathes are deselected using -i
328$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '$mountpoint_valid' -i '$mountpoint2_valid'" );
329cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case sensitive)");
330
331# ignore: exit unknown, if all pathes are deselected using -I
332$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -I '".uc($mountpoint_valid)."' -I '".uc($mountpoint2_valid)."'" );
333cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case insensitive)");
334
335# ignore: exit unknown, if all pathes are deselected using -i
336$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '.*'" );
337cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored using -i '.*'");
338
339# ignore: test if ignored path is actually ignored
340$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^$mountpoint2_valid\$'");
341like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it");
342unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mountpoint2_valid in it");
343
344# ignore: test if all pathes are listed when ignore regex doesn't match
345$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'");
346like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match");
347like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match");