diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-11 20:30:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 20:30:47 (GMT) |
commit | a99db0243baa5d208c5d500a9bde86b4619cec92 (patch) | |
tree | bb779ed4058f41b36259748537fc74e298cfa9fb /plugins/t | |
parent | 5077120a251980b4fafed61b4aa8fa5730a85443 (diff) | |
parent | 357787868b5201ec3e874e7a225b1c944cbbdb4d (diff) | |
download | monitoring-plugins-a99db0243baa5d208c5d500a9bde86b4619cec92.tar.gz |
Merge branch 'master' into master
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_disk.t | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index ec527e7..c8f08f5 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth | |||
23 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | 23 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { |
24 | plan skip_all => "Need 2 mountpoints to test"; | 24 | plan skip_all => "Need 2 mountpoints to test"; |
25 | } else { | 25 | } else { |
26 | plan tests => 78; | 26 | plan tests => 88; |
27 | } | 27 | } |
28 | 28 | ||
29 | $result = NPTest->testCmd( | 29 | $result = NPTest->testCmd( |
@@ -351,3 +351,28 @@ unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mou | |||
351 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); | 351 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); |
352 | like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); | 352 | like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); |
353 | like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); | 353 | like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); |
354 | |||
355 | # ignore-missing: exit okay, when fs is not accessible | ||
356 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); | ||
357 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob"); | ||
358 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /bob;.*$/', 'Output OK'); | ||
359 | |||
360 | # ignore-missing: exit okay, when regex does not match | ||
361 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); | ||
362 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
363 | like( $result->output, '/^DISK OK - No disks were found for provided parameters;.*$/', 'Output OK'); | ||
364 | |||
365 | # ignore-missing: exit okay, when fs with exact match (-E) is not found | ||
366 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -E -p /etc"); | ||
367 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs"); | ||
368 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /etc;.*$/', 'Output OK'); | ||
369 | |||
370 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) | ||
371 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'"); | ||
372 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
373 | like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK'); | ||
374 | |||
375 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) | ||
376 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'"); | ||
377 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
378 | like( $result->output, '/^DISK OK - free space: / .*; - ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file | ||