summaryrefslogtreecommitdiffstats
path: root/plugins/tests/check_http.t
diff options
context:
space:
mode:
authorLorenz <12514511+RincewindsHat@users.noreply.github.com>2022-01-03 12:48:39 (GMT)
committerGitHub <noreply@github.com>2022-01-03 12:48:39 (GMT)
commit2714df42fd27ec377228a102acff3744d6bff86d (patch)
tree3098fa3d9be4826e5da9d1df39ecf6b42bf3570b /plugins/tests/check_http.t
parent11af74de386ba7c02d5d0e53f2500b5029a4537d (diff)
parent78a999edd4dd3305ef8fa3e06c43f6a893fb6fea (diff)
downloadmonitoring-plugins-2714df42fd27ec377228a102acff3744d6bff86d.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'plugins/tests/check_http.t')
-rwxr-xr-xplugins/tests/check_http.t17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t
index 2f051fa..188f5e7 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",
@@ -102,8 +104,6 @@ if ($pid) {
102 exit; 104 exit;
103 } 105 }
104 } 106 }
105 # give our webservers some time to startup
106 sleep(1);
107} else { 107} else {
108 # Child 108 # Child
109 #print "child\n"; 109 #print "child\n";
@@ -116,6 +116,9 @@ if ($pid) {
116 exit; 116 exit;
117} 117}
118 118
119# give our webservers some time to startup
120sleep(3);
121
119# Run the same server on http and https 122# Run the same server on http and https
120sub run_server { 123sub run_server {
121 my $d = shift; 124 my $d = shift;
@@ -414,22 +417,24 @@ sub run_common_tests {
414 417
415 # stickyport - on full urlS port is set back to 80 otherwise 418 # stickyport - on full urlS port is set back to 80 otherwise
416 $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);
417 eval { 421 eval {
418 local $SIG{ALRM} = sub { die "alarm\n" }; 422 local $SIG{ALRM} = sub { die "alarm\n" };
419 alarm(2);
420 $result = NPTest->testCmd( $cmd ); 423 $result = NPTest->testCmd( $cmd );
421 alarm(0); }; 424 };
422 isnt( $@, "alarm\n", $cmd ); 425 isnt( $@, "alarm\n", $cmd );
426 alarm(0);
423 is( $result->return_code, 0, $cmd ); 427 is( $result->return_code, 0, $cmd );
424 428
425 # 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"!
426 $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);
427 eval { 432 eval {
428 local $SIG{ALRM} = sub { die "alarm\n" }; 433 local $SIG{ALRM} = sub { die "alarm\n" };
429 alarm(2);
430 $result = NPTest->testCmd( $cmd ); 434 $result = NPTest->testCmd( $cmd );
431 alarm(0); }; 435 };
432 isnt( $@, "alarm\n", $cmd ); 436 isnt( $@, "alarm\n", $cmd );
437 alarm(0);
433 isnt( $result->return_code, 0, $cmd ); 438 isnt( $result->return_code, 0, $cmd );
434 439
435 # Test an external address - timeout 440 # Test an external address - timeout