diff options
author | Christian Kujau <lists@nerdbynature.de> | 2023-03-21 11:26:03 +0100 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2023-03-21 11:49:08 +0100 |
commit | 3e3e225b3f962993a6139bf5a2c22009b9e9cd32 (patch) | |
tree | d63d05de0aeaa0987014758645d0618e59c7fbd7 /plugins | |
parent | 9c495e2aefedca270f49987dc31bff983e614281 (diff) | |
download | monitoring-plugins-3e3e225.tar.gz |
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@nerdbynature.de>
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/tests/check_procs.t | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 3af218f5..b3a0a301 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -8,7 +8,7 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | 9 | ||
10 | if (-x "./check_procs") { | 10 | if (-x "./check_procs") { |
11 | plan tests => 52; | 11 | plan tests => 54; |
12 | } else { | 12 | } else { |
13 | plan skip_all => "No check_procs compiled"; | 13 | plan skip_all => "No check_procs compiled"; |
14 | } | 14 | } |
@@ -34,9 +34,13 @@ is( $result->return_code, 0, "Checking no threshold breeched" ); | |||
34 | is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" ); | 34 | is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" ); |
35 | 35 | ||
36 | $result = NPTest->testCmd( "$command -C launchd -c 5" ); | 36 | $result = NPTest->testCmd( "$command -C launchd -c 5" ); |
37 | is( $result->return_code, 2, "Checking processes filtered by command name" ); | 37 | is( $result->return_code, 2, "Checking processes matched by command name" ); |
38 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); | 38 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); |
39 | 39 | ||
40 | $result = NPTest->testCmd( "$command -X bash -c 5" ); | ||
41 | is( $result->return_code, 2, "Checking processes excluded by command name" ); | ||
42 | is( $result->output, "PROCS CRITICAL: 95 processes with exclude progs 'bash' | procs=95;;5;0;", "Output correct" ); | ||
43 | |||
40 | SKIP: { | 44 | SKIP: { |
41 | skip 'user with uid 501 required', 4 unless getpwuid(501); | 45 | skip 'user with uid 501 required', 4 unless getpwuid(501); |
42 | 46 | ||