diff options
author | Sven Nierlein <sven@nierlein.de> | 2021-05-21 13:06:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 13:06:37 +0200 |
commit | 6946b546feb9635413932861c4256f0067846860 (patch) | |
tree | 8f2de1d6bb3359796685d2d3ca8c56ddfd4fc110 /plugins/tests | |
parent | f0ac7fcc7c40fab04c00fbbc8c091e89e77b0f74 (diff) | |
parent | b428cc17f75682465e6f1e59b32fdec02b87ceac (diff) | |
download | monitoring-plugins-6946b546feb9635413932861c4256f0067846860.tar.gz |
Merge pull request #1686 from monitoring-plugins/feature_github_actions
Migrate to GitHub actions
Diffstat (limited to 'plugins/tests')
-rwxr-xr-x | plugins/tests/check_curl.t | 5 | ||||
-rwxr-xr-x | plugins/tests/check_http.t | 17 |
2 files changed, 14 insertions, 8 deletions
diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t index 0caad23d..29cb03f2 100755 --- a/plugins/tests/check_curl.t +++ b/plugins/tests/check_curl.t | |||
@@ -126,8 +126,6 @@ if ($pid) { | |||
126 | exit; | 126 | exit; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | # give our webservers some time to startup | ||
130 | sleep(1); | ||
131 | } else { | 129 | } else { |
132 | # Child | 130 | # Child |
133 | #print "child\n"; | 131 | #print "child\n"; |
@@ -140,6 +138,9 @@ if ($pid) { | |||
140 | exit; | 138 | exit; |
141 | } | 139 | } |
142 | 140 | ||
141 | # give our webservers some time to startup | ||
142 | sleep(3); | ||
143 | |||
143 | # Run the same server on http and https | 144 | # Run the same server on http and https |
144 | sub run_server { | 145 | sub run_server { |
145 | my $d = shift; | 146 | my $d = shift; |
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 2f051fad..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", |
@@ -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 | ||
120 | sleep(3); | ||
121 | |||
119 | # Run the same server on http and https | 122 | # Run the same server on http and https |
120 | sub run_server { | 123 | sub 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 |