changeset 755:f95aa716624e

Tests: HTTP/2 tests for alerts on graceful shutdown. Made sure that gracefully shutting down with a stream waiting for a window update, for remaining request body data frames, or that stuck on incomplete HEADERS payload, doesn't lead to "open socket ... left in connection" alerts.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 28 Oct 2015 00:11:43 +0300
parents 84a52b6d6343
children bb4486e173ab
files h2.t
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/h2.t
+++ b/h2.t
@@ -34,9 +34,9 @@ my $t = Test::Nginx->new()->has(qw/http 
 	->has(qw/limit_conn rewrite realip shmem/)
 	->has_daemon('openssl')->plan(233);
 
-# Some systems have a bug in not treating zero writev iovcnt as EINVAL
-
-$t->todo_alerts() if $^O eq 'darwin';
+# Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
+
+$t->todo_alerts();
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -210,6 +210,11 @@ http {
         server_name  localhost;
 
         http2_idle_timeout 1s;
+
+        location /proxy2/ {
+            add_header X-Body "$request_body";
+            proxy_pass http://127.0.0.1:8081/;
+        }
     }
 }
 
@@ -2267,6 +2272,23 @@ is($frame->{value}, 'SEE-THIS', 'unknown
 $sid = new_stream($sess, { path => 't1.html' });
 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
 
+# graceful shutdown with stream waiting on HEADERS payload
+
+my $grace = new_session(8089);
+new_stream($grace, { split => [ 9 ], abort => 1 });
+
+# graceful shutdown with stream waiting on WINDOW_UPDATE
+
+my $grace2 = new_session(8089);
+$sid = new_stream($grace2, { path => '/t1.html' });
+h2_read($grace2, all => [{ sid => $sid, length => 2**16 - 1 }]);
+
+# graceful shutdown waiting on incomplete request body DATA frames
+
+my $grace3 = new_session(8090);
+$sid = new_stream($grace3, { path => '/proxy2/t2.html', body => 'TEST',
+	body_split => [ 2 ], split => [ 67 ], abort => 1 });
+
 $t->stop();
 
 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);