summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKristian Schuster <116557017+KriSchu@users.noreply.github.com>2022-10-25 20:49:51 +0200
committerKristian Schuster <116557017+KriSchu@users.noreply.github.com>2022-10-25 20:49:51 +0200
commit0d562a356f45f645014c3908178fc13876006f6e (patch)
tree99b49e835ec59859c8923ebe7526a1ab0ada5b3c /plugins
parent8cf31437e99167ad9c260e6677b4d1ed31a34d56 (diff)
downloadmonitoring-plugins-0d562a3.tar.gz
check_disk: add tests for new option --ignore-missing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/t/check_disk.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index ec527e7f..bea34a4c 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\$'");
352like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); 352like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match");
353like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); 353like( $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");
357cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob");
358like( $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");
362cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching");
363like( $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");
367cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs");
368like( $result->output, '/^DISK OK: /etc not found.*$/', 'Output OK');