diff options
author | Sven Nierlein <sven@nierlein.de> | 2021-05-20 20:57:59 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2021-05-20 20:57:59 +0200 |
commit | b428cc17f75682465e6f1e59b32fdec02b87ceac (patch) | |
tree | 8f2de1d6bb3359796685d2d3ca8c56ddfd4fc110 /plugins/tests/check_http.t | |
parent | eb75d847ae31a86768b06926bc2323f7c16f07b9 (diff) | |
download | monitoring-plugins-b428cc17f75682465e6f1e59b32fdec02b87ceac.tar.gz |
tests: ignore sigpipes in https test daemon
check_http closes the connection after checking the certificate with -C. This leads to sigpipe
errors when the ssl daemon wants to send a response and the daemon quits which makes the
subsequent tests fail.
Diffstat (limited to 'plugins/tests/check_http.t')
-rwxr-xr-x | plugins/tests/check_http.t | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 0f56950f..188f5e75 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t | |||
@@ -91,6 +91,8 @@ if ($pid) { | |||
91 | exit; | 91 | exit; |
92 | } | 92 | } |
93 | } else { | 93 | } else { |
94 | # closing the connection after -C cert checks make the daemon exit with a sigpipe otherwise | ||
95 | local $SIG{'PIPE'} = 'IGNORE'; | ||
94 | my $d = HTTP::Daemon::SSL->new( | 96 | my $d = HTTP::Daemon::SSL->new( |
95 | LocalPort => $port_https, | 97 | LocalPort => $port_https, |
96 | LocalAddr => "127.0.0.1", | 98 | LocalAddr => "127.0.0.1", |
@@ -415,22 +417,24 @@ sub run_common_tests { | |||
415 | 417 | ||
416 | # stickyport - on full urlS port is set back to 80 otherwise | 418 | # stickyport - on full urlS port is set back to 80 otherwise |
417 | $cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected"; | 419 | $cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected"; |
420 | alarm(2); | ||
418 | eval { | 421 | eval { |
419 | local $SIG{ALRM} = sub { die "alarm\n" }; | 422 | local $SIG{ALRM} = sub { die "alarm\n" }; |
420 | alarm(2); | ||
421 | $result = NPTest->testCmd( $cmd ); | 423 | $result = NPTest->testCmd( $cmd ); |
422 | alarm(0); }; | 424 | }; |
423 | isnt( $@, "alarm\n", $cmd ); | 425 | isnt( $@, "alarm\n", $cmd ); |
426 | alarm(0); | ||
424 | is( $result->return_code, 0, $cmd ); | 427 | is( $result->return_code, 0, $cmd ); |
425 | 428 | ||
426 | # Let's hope there won't be any web server on :80 returning "redirected"! | 429 | # Let's hope there won't be any web server on :80 returning "redirected"! |
427 | $cmd = "$command -f sticky -u /redir_external -t 5 -s redirected"; | 430 | $cmd = "$command -f sticky -u /redir_external -t 5 -s redirected"; |
431 | alarm(2); | ||
428 | eval { | 432 | eval { |
429 | local $SIG{ALRM} = sub { die "alarm\n" }; | 433 | local $SIG{ALRM} = sub { die "alarm\n" }; |
430 | alarm(2); | ||
431 | $result = NPTest->testCmd( $cmd ); | 434 | $result = NPTest->testCmd( $cmd ); |
432 | alarm(0); }; | 435 | }; |
433 | isnt( $@, "alarm\n", $cmd ); | 436 | isnt( $@, "alarm\n", $cmd ); |
437 | alarm(0); | ||
434 | isnt( $result->return_code, 0, $cmd ); | 438 | isnt( $result->return_code, 0, $cmd ); |
435 | 439 | ||
436 | # Test an external address - timeout | 440 | # Test an external address - timeout |