diff options
-rw-r--r-- | plugins/t/check_load.t | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t index 8f954dc..749dcc1 100644 --- a/plugins/t/check_load.t +++ b/plugins/t/check_load.t | |||
@@ -6,20 +6,21 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use Test; | 9 | use Test::More; |
10 | use NPTest; | 10 | use NPTest; |
11 | 11 | ||
12 | use vars qw($tests); | 12 | my $res; |
13 | BEGIN {$tests = 4; plan tests => $tests} | ||
14 | 13 | ||
15 | my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; | 14 | my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; |
16 | my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; | 15 | my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/'; |
17 | 16 | ||
18 | my $t; | 17 | plan tests => 4; |
19 | 18 | ||
20 | $t += checkCmd( "./check_load -w 100,100,100 -c 100,100,100", 0, $successOutput ); | 19 | $res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" ); |
21 | $t += checkCmd( "./check_load -w 0,0,0 -c 0,0,0", 2, $failureOutput ); | 20 | cmp_ok( $res->return_code, 'eq', 0, "load not over 100"); |
21 | like( $res->output, $successOutput, "Output OK"); | ||
22 | 22 | ||
23 | exit(0) if defined($Test::Harness::VERSION); | 23 | $res = NPTest->testCmd( "./check_load -w 0,0,0 -c 0,0,0" ); |
24 | exit($tests - $t); | 24 | cmp_ok( $res->return_code, 'eq', 2, "Load over 0"); |
25 | like( $res->output, $failureOutput, "Output OK"); | ||
25 | 26 | ||