diff options
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r-- | plugins/t/check_disk.t | 31 |
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 | |||
24 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | 24 | if ($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" ); | |||
284 | cmp_ok( $result->return_code, '==', 0, "Checking /etc - should return info for /" ); | 284 | cmp_ok( $result->return_code, '==', 0, "Checking /etc - should return info for /" ); |
285 | cmp_ok( $result->output, 'eq', $root_output, "check_disk /etc gives same as check_disk /"); | 285 | cmp_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 " ); |
288 | cmp_ok( $result->return_code, '==', 2, "... unless -E/--exact-match is specified"); | 288 | cmp_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 " ); | ||
291 | cmp_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 " ); | ||
294 | cmp_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" ); |
291 | cmp_ok( $result->return_code, '==', 2, "Checking / and /bob gives critical"); | 297 | cmp_ok( $result->return_code, '==', 2, "Checking / and /bob gives critical"); |
292 | unlike( $result->perf_output, '/\/bob/', "perf data does not have /bob in it"); | 298 | unlike( $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 '('" ); |
319 | cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable"); | 325 | cmp_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'" ); | ||
329 | cmp_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)."'" ); | ||
333 | cmp_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 '.*'" ); | ||
337 | cmp_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\$'"); | ||
341 | like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it"); | ||
342 | unlike( $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\$'"); | ||
346 | like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); | ||
347 | like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); | ||