summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/t/80graceful-shutdown.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /web/server/h2o/libh2o/t/80graceful-shutdown.t
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz
netdata-5da14042f70711ea5cf66e034699730335462f66.zip
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/t/80graceful-shutdown.t')
-rw-r--r--web/server/h2o/libh2o/t/80graceful-shutdown.t80
1 files changed, 0 insertions, 80 deletions
diff --git a/web/server/h2o/libh2o/t/80graceful-shutdown.t b/web/server/h2o/libh2o/t/80graceful-shutdown.t
deleted file mode 100644
index cdc904f94..000000000
--- a/web/server/h2o/libh2o/t/80graceful-shutdown.t
+++ /dev/null
@@ -1,80 +0,0 @@
-use strict;
-use warnings;
-use Net::EmptyPort qw(check_port empty_port);
-use Test::More;
-use t::Util;
-
-plan skip_all => 'nghttp not found'
- unless prog_exists('nghttp');
-
-plan skip_all => 'plackup not found'
- unless prog_exists('plackup');
-
-plan skip_all => 'Starlet not found'
- unless system('perl -MStarlet /dev/null > /dev/null 2>&1') == 0;
-
-my $upstream_port = empty_port();
-my $upstream_hostport = "127.0.0.1:$upstream_port";
-
-sub create_upstream {
- my @args = (
- qw(plackup -s Starlet --keepalive-timeout 100 --access-log /dev/null --listen),
- $upstream_hostport,
- ASSETS_DIR . "/upstream.psgi",
- );
- spawn_server(
- argv => \@args,
- is_ready => sub {
- $upstream_hostport =~ /:([0-9]+)$/s
- or die "failed to extract port number";
- check_port($1);
- },
- );
-};
-
-sub doit {
- my $timeout = shift;
- my $server = spawn_h2o(<< "EOT");
-http2-graceful-shutdown-timeout: $timeout
-hosts:
- default:
- paths:
- "/":
- proxy.reverse.url: http://127.0.0.1:$upstream_port
-EOT
-
- my $upstream = create_upstream();
- my $nghttp_pid = open(NGHTTP, "nghttp -w 1 -v http://127.0.0.1:$server->{'port'}/infinite-stream 2>&1 |");
-
- my $nghttp_interrupted=0;
- eval {
- local $SIG{ALRM} = sub { die "Timeout" };
- my $stopped=0;
- alarm(5);
- while (<NGHTTP>) {
- if (/recv DATA frame/ && !$stopped) {
- # after the request started, stop H2O
- kill 'TERM', $server->{pid};
- $stopped = 1;
- }
- if (/Some requests were not processed/) {
- $nghttp_interrupted = 1;
- }
- }
- alarm(0);
- };
- my $err = $@;
- if ($timeout == 1) {
- ok($nghttp_interrupted == 1, "nghttp was interrupted");
- ok($err !~ /^Timeout/, "nghttp didn't timeout");
- } else {
- kill 'TERM', $nghttp_pid;
- ok($nghttp_interrupted == 0, "nghttp was not interrupted");
- ok($err =~ /^Timeout/, "nghttp did timeout");
- }
-}
-
-doit(0);
-doit(1);
-
-done_testing();