diff options
author | Sven Nierlein <Sven.Nierlein@consol.de> | 2014-06-12 13:56:48 +0200 |
---|---|---|
committer | Sven Nierlein <Sven.Nierlein@consol.de> | 2014-06-12 13:56:48 +0200 |
commit | c5a6c5136a2a7e629907b04a63dff059603bdb09 (patch) | |
tree | e6c9d47b240904752f2bf056bdc9dd92f7a83562 /plugins/tests/check_http.t | |
parent | 3529d7465d31234ec634939ed1a6bdc915b73ccd (diff) | |
download | monitoring-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/check_http.t')
-rwxr-xr-x | plugins/tests/check_http.t | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 2c89beb0..c40bb076 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t @@ -392,27 +392,21 @@ sub run_common_tests { skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); $cmd = "$command -f follow -u /redir_external -t 5"; eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm(2); - $result = NPTest->testCmd( $cmd ); - alarm(0); }; - is( $@, "alarm\n", $cmd ); + $result = NPTest->testCmd( $cmd, 2 ); + }; + like( $@, "/timeout in command: $cmd/", $cmd ); } $cmd = "$command -u /timeout -t 5"; eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm(2); - $result = NPTest->testCmd( $cmd ); - alarm(0); }; - is( $@, "alarm\n", $cmd ); + $result = NPTest->testCmd( $cmd, 2 ); + }; + like( $@, "/timeout in command: $cmd/", $cmd ); $cmd = "$command -f follow -u /redir_timeout -t 2"; eval { - local $SIG{ALRM} = sub { die "alarm\n" }; - alarm(5); - $result = NPTest->testCmd( $cmd ); - alarm(0); }; - isnt( $@, "alarm\n", $cmd ); + $result = NPTest->testCmd( $cmd, 5 ); + }; + is( $@, "", $cmd ); } |