summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-20 00:27:23 (GMT)
committerKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-20 00:27:23 (GMT)
commita58293a0c288ee0e050c79715073da9fbdfc4c58 (patch)
tree91017c092b9dc436aeaa5ff55664739f55796197
parenta0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (diff)
downloadmonitoring-plugins-a58293a.tar.gz
check_disk: fix tests by setting correct test number and escaping line end regex
-rw-r--r--plugins/t/check_disk.t8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index 275db70..73f1e37 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
23if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { 23if ($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 => 86; 26 plan tests => 88;
27} 27}
28 28
29$result = NPTest->testCmd( 29$result = NPTest->testCmd(
@@ -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" );
129is( $result->only_output, "DISK OK", "No print out of disks with -e for OKs"); 129is( $result->only_output, "DISK OK - No disks were found for provided parameters;", "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" );
132cmp_ok( $result->return_code, '==', 0, "Old syntax okay" ); 132cmp_ok( $result->return_code, '==', 0, "Old syntax okay" );
@@ -368,9 +368,9 @@ cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact m
368like( $result->output, '/^DISK OK - No disks were found for provided parameters; ignored paths: /etc;.*$/', 'Output OK'); 368like( $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 '^/\$'");
372cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); 372cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching");
373like( $result->output, '/^DISK OK - free space: / .*$/', 'Output OK'); 373like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK');
374 374
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 '/'");