[monitoring-plugins] check_procs: add a test for the newly added -X ...
Sven Nierlein
git at monitoring-plugins.org
Tue Mar 21 11:50:11 CET 2023
Module: monitoring-plugins
Branch: master
Commit: 3e3e225b3f962993a6139bf5a2c22009b9e9cd32
Author: Christian Kujau <lists at nerdbynature.de>
Committer: Sven Nierlein <sven at nierlein.org>
Date: Tue Mar 21 11:26:03 2023 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=3e3e225
check_procs: add a test for the newly added -X option.
$ make test
[...]
perl -I .. -I .. ../test.pl
No application (check_curl) found for test harness (check_curl.t)
No application (check_snmp) found for test harness (check_snmp.t)
./t/check_procs.t ...... ok
./tests/check_nt.t ..... ok
./tests/check_procs.t .. ok
All tests successful.
Files=4, Tests=73, 8 wallclock secs ( 0.05 usr 0.02 sys + 0.38 cusr
0.22 csys = 0.67 CPU)
Result: PASS
Signed-off-by: Christian Kujau <lists at nerdbynature.de>
---
plugins/tests/check_procs.t | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t
index 3af218f..b3a0a30 100755
--- a/plugins/tests/check_procs.t
+++ b/plugins/tests/check_procs.t
@@ -8,7 +8,7 @@ use Test::More;
use NPTest;
if (-x "./check_procs") {
- plan tests => 52;
+ plan tests => 54;
} else {
plan skip_all => "No check_procs compiled";
}
@@ -34,9 +34,13 @@ is( $result->return_code, 0, "Checking no threshold breeched" );
is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" );
$result = NPTest->testCmd( "$command -C launchd -c 5" );
-is( $result->return_code, 2, "Checking processes filtered by command name" );
+is( $result->return_code, 2, "Checking processes matched by command name" );
is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" );
+$result = NPTest->testCmd( "$command -X bash -c 5" );
+is( $result->return_code, 2, "Checking processes excluded by command name" );
+is( $result->output, "PROCS CRITICAL: 95 processes with exclude progs 'bash' | procs=95;;5;0;", "Output correct" );
+
SKIP: {
skip 'user with uid 501 required', 4 unless getpwuid(501);
More information about the Commits
mailing list