diff options
author | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2022-10-25 18:49:51 (GMT) |
---|---|---|
committer | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2022-10-25 18:49:51 (GMT) |
commit | 0d562a356f45f645014c3908178fc13876006f6e (patch) | |
tree | 99b49e835ec59859c8923ebe7526a1ab0ada5b3c /plugins/t | |
parent | 8cf31437e99167ad9c260e6677b4d1ed31a34d56 (diff) | |
download | monitoring-plugins-0d562a356f45f645014c3908178fc13876006f6e.tar.gz |
check_disk: add tests for new option --ignore-missing
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_disk.t | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index ec527e7..bea34a4 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -351,3 +351,18 @@ 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 - /bob is not accessible .*$/', '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: Regular expression did not match any path or disk.*$/', '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 -E -w 0% -c 0% -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: /etc not found.*$/', 'Output OK'); | ||