diff options
Diffstat (limited to 'plugins/tests/check_procs.t')
-rwxr-xr-x | plugins/tests/check_procs.t | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 54d43d9..3af218f 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -8,13 +8,14 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | 9 | ||
10 | if (-x "./check_procs") { | 10 | if (-x "./check_procs") { |
11 | plan tests => 50; | 11 | plan tests => 52; |
12 | } else { | 12 | } else { |
13 | plan skip_all => "No check_procs compiled"; | 13 | plan skip_all => "No check_procs compiled"; |
14 | } | 14 | } |
15 | 15 | ||
16 | my $result; | 16 | my $result; |
17 | my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin"; | 17 | my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin"; |
18 | my $cmd_etime = "./check_procs --input-file=tests/var/ps-axwo.debian"; | ||
18 | 19 | ||
19 | $result = NPTest->testCmd( "$command" ); | 20 | $result = NPTest->testCmd( "$command" ); |
20 | is( $result->return_code, 0, "Run with no options" ); | 21 | is( $result->return_code, 0, "Run with no options" ); |
@@ -69,9 +70,21 @@ SKIP: { | |||
69 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); | 70 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); |
70 | }; | 71 | }; |
71 | 72 | ||
72 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); | 73 | SKIP: { |
73 | is( $result->return_code, 0, "Checking regexp search of arguments" ); | 74 | skip 'check_procs is compiled with etime format support', 2 if `$command -vvv` =~ m/etime/mx; |
74 | is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" ); | 75 | |
76 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); | ||
77 | is( $result->return_code, 0, "Checking regexp search of arguments" ); | ||
78 | is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" ); | ||
79 | } | ||
80 | |||
81 | SKIP: { | ||
82 | skip 'check_procs is compiled without etime format support', 2 if `$cmd_etime -vvv` !~ m/etime/mx; | ||
83 | |||
84 | $result = NPTest->testCmd( "$cmd_etime -m ELAPSED -C apache2 -w 1000 -c 2000" ); | ||
85 | is( $result->return_code, 2, "Checking elapsed time threshold" ); | ||
86 | is( $result->output, "ELAPSED CRITICAL: 10 crit, 0 warn out of 10 processes with command name 'apache2' | procs=10;;;0; procs_warn=0;;;0; procs_crit=10;;;0;", "Output correct" ); | ||
87 | } | ||
75 | 88 | ||
76 | $result = NPTest->testCmd( "$command --vsz 1000000" ); | 89 | $result = NPTest->testCmd( "$command --vsz 1000000" ); |
77 | is( $result->return_code, 0, "Checking filter by VSZ" ); | 90 | is( $result->return_code, 0, "Checking filter by VSZ" ); |
@@ -83,7 +96,7 @@ is( $result->output, 'PROCS OK: 3 processes with RSS >= 100000 | procs=3;;;0;', | |||
83 | 96 | ||
84 | $result = NPTest->testCmd( "$command -s S" ); | 97 | $result = NPTest->testCmd( "$command -s S" ); |
85 | is( $result->return_code, 0, "Checking filter for sleeping processes" ); | 98 | is( $result->return_code, 0, "Checking filter for sleeping processes" ); |
86 | like( $result->output, '/^PROCS OK: 44 processes with STATE = S/', "Output correct" ); | 99 | like( $result->output, '/^PROCS OK: 88 processes with STATE = S/', "Output correct" ); |
87 | 100 | ||
88 | $result = NPTest->testCmd( "$command -s Z" ); | 101 | $result = NPTest->testCmd( "$command -s Z" ); |
89 | is( $result->return_code, 0, "Checking filter for zombies" ); | 102 | is( $result->return_code, 0, "Checking filter for zombies" ); |
@@ -129,4 +142,3 @@ is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowSe | |||
129 | $result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" ); | 142 | $result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" ); |
130 | is( $result->return_code, 0, "Checking no pipe symbol in output" ); | 143 | is( $result->return_code, 0, "Checking no pipe symbol in output" ); |
131 | is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" ); | 144 | is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" ); |
132 | |||