summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_curl.t4
-rw-r--r--plugins/t/check_http.t4
-rw-r--r--plugins/t/check_swap.t14
3 files changed, 17 insertions, 5 deletions
diff --git a/plugins/t/check_curl.t b/plugins/t/check_curl.t
index eae98cc..7a930a4 100644
--- a/plugins/t/check_curl.t
+++ b/plugins/t/check_curl.t
@@ -205,9 +205,9 @@ SKIP: {
205 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); 205 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
206 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); 206 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
207 207
208 $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f curl" ); 208 $res = NPTest->testCmd( "./$plugin -H monitoring-plugins.org -u /download.html -f follow" );
209 is( $res->return_code, 0, "Redirection based on location is okay"); 209 is( $res->return_code, 0, "Redirection based on location is okay");
210 210
211 $res = NPTest->testCmd( "./$plugin -H www.mozilla.com --extended-perfdata" ); 211 $res = NPTest->testCmd( "./$plugin -H monitoring-plugins.org --extended-perfdata" );
212 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); 212 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
213} 213}
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index 1f2fbdf..6ab4a5b 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -166,10 +166,10 @@ SKIP: {
166 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); 166 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
167 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); 167 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
168 168
169 $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f follow" ); 169 $res = NPTest->testCmd( "./$plugin -H monitoring-plugins.org -u /download.html -f follow" );
170 is( $res->return_code, 0, "Redirection based on location is okay"); 170 is( $res->return_code, 0, "Redirection based on location is okay");
171 171
172 $res = NPTest->testCmd( "./$plugin -H www.mozilla.com --extended-perfdata" ); 172 $res = NPTest->testCmd( "./$plugin -H monitoring-plugins.org --extended-perfdata" );
173 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); 173 like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
174} 174}
175 175
diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t
index de9e0f0..1878038 100644
--- a/plugins/t/check_swap.t
+++ b/plugins/t/check_swap.t
@@ -5,7 +5,7 @@
5# 5#
6 6
7use strict; 7use strict;
8use Test::More tests => 8; 8use Test::More tests => 14;
9use NPTest; 9use NPTest;
10 10
11my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/'; 11my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/';
@@ -14,6 +14,10 @@ my $warnOutput = '/^SWAP WARNING - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)
14 14
15my $result; 15my $result;
16 16
17$result = NPTest->testCmd( "./check_swap" ); # Always OK
18cmp_ok( $result->return_code, "==", 0, "Always OK" );
19like( $result->output, $successOutput, "Right output" );
20
17$result = NPTest->testCmd( "./check_swap -w 1048576 -c 1048576" ); # 1 MB free 21$result = NPTest->testCmd( "./check_swap -w 1048576 -c 1048576" ); # 1 MB free
18cmp_ok( $result->return_code, "==", 0, "At least 1MB free" ); 22cmp_ok( $result->return_code, "==", 0, "At least 1MB free" );
19like( $result->output, $successOutput, "Right output" ); 23like( $result->output, $successOutput, "Right output" );
@@ -29,3 +33,11 @@ like( $result->output, $failureOutput, "Right output" );
29$result = NPTest->testCmd( "./check_swap -w 100% -c 1%" ); # 100% (always warn) 33$result = NPTest->testCmd( "./check_swap -w 100% -c 1%" ); # 100% (always warn)
30cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); 34cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
31like( $result->output, $warnOutput, "Right output" ); 35like( $result->output, $warnOutput, "Right output" );
36
37$result = NPTest->testCmd( "./check_swap -w 100%" ); # 100% (single threshold, always warn)
38cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' );
39like( $result->output, $warnOutput, "Right output" );
40
41$result = NPTest->testCmd( "./check_swap -c 100%" ); # 100% (single threshold, always critical)
42cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' );
43like( $result->output, $failureOutput, "Right output" );