diff options
Diffstat (limited to 'plugins/t/check_load.t')
-rw-r--r-- | plugins/t/check_load.t | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t index 60837ef6..bba8947c 100644 --- a/plugins/t/check_load.t +++ b/plugins/t/check_load.t | |||
@@ -11,10 +11,12 @@ use NPTest; | |||
11 | my $res; | 11 | my $res; |
12 | 12 | ||
13 | my $loadValue = "[0-9]+\.?[0-9]+"; | 13 | my $loadValue = "[0-9]+\.?[0-9]+"; |
14 | my $successOutput = "/^LOAD OK - load average: $loadValue, $loadValue, $loadValue/"; | 14 | my $successOutput = "/^LOAD OK - total load average: $loadValue, $loadValue, $loadValue/"; |
15 | my $failureOutput = "/^LOAD CRITICAL - load average: $loadValue, $loadValue, $loadValue/"; | 15 | my $successScaledOutput = "/^LOAD OK - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/"; |
16 | my $failureOutput = "/^LOAD CRITICAL - total load average: $loadValue, $loadValue, $loadValue/"; | ||
17 | my $failurScaledOutput = "/^LOAD CRITICAL - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/"; | ||
16 | 18 | ||
17 | plan tests => 11; | 19 | plan tests => 13; |
18 | 20 | ||
19 | $res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" ); | 21 | $res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" ); |
20 | cmp_ok( $res->return_code, 'eq', 0, "load not over 100"); | 22 | cmp_ok( $res->return_code, 'eq', 0, "load not over 100"); |
@@ -26,7 +28,7 @@ like( $res->output, $failureOutput, "Output OK"); | |||
26 | 28 | ||
27 | $res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" ); | 29 | $res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" ); |
28 | cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division"); | 30 | cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division"); |
29 | like( $res->output, $failureOutput, "Output OK"); | 31 | like( $res->output, $failurScaledOutput, "Output OK"); |
30 | 32 | ||
31 | $res = NPTest->testCmd( "./check_load -w 100 -c 100,110" ); | 33 | $res = NPTest->testCmd( "./check_load -w 100 -c 100,110" ); |
32 | cmp_ok( $res->return_code, 'eq', 0, "Plugin can handle non-triplet-arguments"); | 34 | cmp_ok( $res->return_code, 'eq', 0, "Plugin can handle non-triplet-arguments"); |
@@ -34,3 +36,8 @@ like( $res->output, $successOutput, "Output OK"); | |||
34 | like( $res->perf_output, "/load1=$loadValue;100.000;100.000/", "Test handling of non triplet thresholds (load1)"); | 36 | like( $res->perf_output, "/load1=$loadValue;100.000;100.000/", "Test handling of non triplet thresholds (load1)"); |
35 | like( $res->perf_output, "/load5=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load5)"); | 37 | like( $res->perf_output, "/load5=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load5)"); |
36 | like( $res->perf_output, "/load15=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load15)"); | 38 | like( $res->perf_output, "/load15=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load15)"); |
39 | |||
40 | |||
41 | $res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100 -r" ); | ||
42 | cmp_ok( $res->return_code, 'eq', 0, "load not over 100"); | ||
43 | like( $res->output, $successScaledOutput, "Output OK"); | ||