diff options
author | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-20 01:03:01 (GMT) |
---|---|---|
committer | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-20 01:03:01 (GMT) |
commit | e102b8a49e857a474db516455d2e871e6834ae34 (patch) | |
tree | 6057994e8c341c481b8b50e9ba9aec12e978e864 /plugins/t/check_disk.t | |
parent | a58293a0c288ee0e050c79715073da9fbdfc4c58 (diff) | |
download | monitoring-plugins-e102b8a49e857a474db516455d2e871e6834ae34.tar.gz |
check_disk: fix ugly output with -e option and adapt tests accordingly
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r-- | plugins/t/check_disk.t | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 73f1e37..c8f08f5 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -126,7 +126,7 @@ my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; | |||
126 | 126 | ||
127 | 127 | ||
128 | $result = NPTest->testCmd( "./check_disk -e -w 1 -c 1 -p $more_free" ); | 128 | $result = NPTest->testCmd( "./check_disk -e -w 1 -c 1 -p $more_free" ); |
129 | is( $result->only_output, "DISK OK - No disks were found for provided parameters;", "No print out of disks with -e for OKs"); | 129 | is( $result->only_output, "DISK OK", "No print out of disks with -e for OKs"); |
130 | 130 | ||
131 | $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); | 131 | $result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); |
132 | cmp_ok( $result->return_code, '==', 0, "Old syntax okay" ); | 132 | cmp_ok( $result->return_code, '==', 0, "Old syntax okay" ); |
@@ -355,7 +355,7 @@ like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mo | |||
355 | # ignore-missing: exit okay, when fs is not accessible | 355 | # ignore-missing: exit okay, when fs is not accessible |
356 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); | 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"); | 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'); | 358 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /bob;.*$/', 'Output OK'); |
359 | 359 | ||
360 | # ignore-missing: exit okay, when regex does not match | 360 | # ignore-missing: exit okay, when regex does not match |
361 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); | 361 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); |
@@ -365,7 +365,7 @@ like( $result->output, '/^DISK OK - No disks were found for provided parameters; | |||
365 | # ignore-missing: exit okay, when fs with exact match (-E) is not found | 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"); | 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"); | 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'); | 368 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /etc;.*$/', 'Output OK'); |
369 | 369 | ||
370 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) | 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 '^/\$'"); | 371 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'"); |
@@ -375,4 +375,4 @@ like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK'); | |||
375 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) | 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 '/'"); | 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"); | 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 | 378 | like( $result->output, '/^DISK OK - free space: / .*; - ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file |