diff options
Diffstat (limited to 'plugins/tests')
-rwxr-xr-x | plugins/tests/check_http.t | 4 | ||||
-rwxr-xr-x | plugins/tests/check_snmp.t | 27 |
2 files changed, 30 insertions, 1 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 9ae6bbdc..8337f52a 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t | |||
@@ -188,6 +188,10 @@ SKIP: { | |||
188 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); | 188 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); |
189 | like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); | 189 | like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); |
190 | 190 | ||
191 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); | ||
192 | is( $result->return_code, 1, "$command -p $port_https -S -C 139600,14000" ); | ||
193 | like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" ); | ||
194 | |||
191 | # Expired cert tests | 195 | # Expired cert tests |
192 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); | 196 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); |
193 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); | 197 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); |
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index 2645cc1b..1ef0b209 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -8,7 +8,7 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | use FindBin qw($Bin); | 9 | use FindBin qw($Bin); |
10 | 10 | ||
11 | my $tests = 41; | 11 | my $tests = 53; |
12 | # Check that all dependent modules are available | 12 | # Check that all dependent modules are available |
13 | eval { | 13 | eval { |
14 | require NetSNMP::OID; | 14 | require NetSNMP::OID; |
@@ -144,6 +144,31 @@ is($res->return_code, 0, "OK as no thresholds" ); | |||
144 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); | 144 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); |
145 | 145 | ||
146 | 146 | ||
147 | # label performance data check | ||
148 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test" ); | ||
149 | is($res->return_code, 0, "OK as no thresholds" ); | ||
150 | is($res->output, "SNMP OK - test 67996 | test=67996c ", "Check label"); | ||
151 | |||
152 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l \"test'test\"" ); | ||
153 | is($res->return_code, 0, "OK as no thresholds" ); | ||
154 | is($res->output, "SNMP OK - test'test 68662 | \"test'test\"=68662c ", "Check label"); | ||
155 | |||
156 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test\"test'" ); | ||
157 | is($res->return_code, 0, "OK as no thresholds" ); | ||
158 | is($res->output, "SNMP OK - test\"test 69328 | 'test\"test'=69328c ", "Check label"); | ||
159 | |||
160 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test -O" ); | ||
161 | is($res->return_code, 0, "OK as no thresholds" ); | ||
162 | is($res->output, "SNMP OK - test 69994 | iso.3.6.1.4.1.8072.3.2.67.10=69994c ", "Check label"); | ||
163 | |||
164 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10" ); | ||
165 | is($res->return_code, 0, "OK as no thresholds" ); | ||
166 | is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label"); | ||
167 | |||
168 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test test'" ); | ||
169 | is($res->return_code, 0, "OK as no thresholds" ); | ||
170 | is($res->output, "SNMP OK - test test 71326 | 'test test'=71326c ", "Check label"); | ||
171 | |||
147 | 172 | ||
148 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); | 173 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); |
149 | is($res->return_code, 0, "OK for first call" ); | 174 | is($res->return_code, 0, "OK for first call" ); |