summaryrefslogtreecommitdiffstats
path: root/plugins/tests
diff options
context:
space:
mode:
authorSven Nierlein <Sven.Nierlein@consol.de>2014-06-12 11:56:48 (GMT)
committerSven Nierlein <Sven.Nierlein@consol.de>2014-06-12 11:56:48 (GMT)
commitc5a6c5136a2a7e629907b04a63dff059603bdb09 (patch)
treee6c9d47b240904752f2bf056bdc9dd92f7a83562 /plugins/tests
parent3529d7465d31234ec634939ed1a6bdc915b73ccd (diff)
downloadmonitoring-plugins-c5a6c5136a2a7e629907b04a63dff059603bdb09.tar.gz
tests: testCmd has own timeout which overwrites local one
so add configurable/optional timeout to testCmd. Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
Diffstat (limited to 'plugins/tests')
-rwxr-xr-xplugins/tests/check_http.t24
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t
index 2c89beb..c40bb07 100755
--- a/plugins/tests/check_http.t
+++ b/plugins/tests/check_http.t
@@ -392,27 +392,21 @@ sub run_common_tests {
392 skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); 392 skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL});
393 $cmd = "$command -f follow -u /redir_external -t 5"; 393 $cmd = "$command -f follow -u /redir_external -t 5";
394 eval { 394 eval {
395 local $SIG{ALRM} = sub { die "alarm\n" }; 395 $result = NPTest->testCmd( $cmd, 2 );
396 alarm(2); 396 };
397 $result = NPTest->testCmd( $cmd ); 397 like( $@, "/timeout in command: $cmd/", $cmd );
398 alarm(0); };
399 is( $@, "alarm\n", $cmd );
400 } 398 }
401 399
402 $cmd = "$command -u /timeout -t 5"; 400 $cmd = "$command -u /timeout -t 5";
403 eval { 401 eval {
404 local $SIG{ALRM} = sub { die "alarm\n" }; 402 $result = NPTest->testCmd( $cmd, 2 );
405 alarm(2); 403 };
406 $result = NPTest->testCmd( $cmd ); 404 like( $@, "/timeout in command: $cmd/", $cmd );
407 alarm(0); };
408 is( $@, "alarm\n", $cmd );
409 405
410 $cmd = "$command -f follow -u /redir_timeout -t 2"; 406 $cmd = "$command -f follow -u /redir_timeout -t 2";
411 eval { 407 eval {
412 local $SIG{ALRM} = sub { die "alarm\n" }; 408 $result = NPTest->testCmd( $cmd, 5 );
413 alarm(5); 409 };
414 $result = NPTest->testCmd( $cmd ); 410 is( $@, "", $cmd );
415 alarm(0); };
416 isnt( $@, "alarm\n", $cmd );
417 411
418} 412}