comparison h2.t @ 1206:c99c1f43cb15

Tests: reload() introduced in Test::Nginx. This method replaces ad-hoc solutions to reload nginx, and adds win32 support.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 09 Aug 2017 15:57:38 +0300
parents 368ab1d8ed8b
children 766bcbb632ee
comparison
equal deleted inserted replaced
1205:c0fa3f818103 1206:c99c1f43cb15
1115 select undef, undef, undef, 1.1; 1115 select undef, undef, undef, 1.1;
1116 undef $grace4; 1116 undef $grace4;
1117 1117
1118 # GOAWAY without awaiting active streams, further streams ignored 1118 # GOAWAY without awaiting active streams, further streams ignored
1119 1119
1120 SKIP: {
1121 skip 'win32', 3 if $^O eq 'MSWin32';
1122
1123 TODO: { 1120 TODO: {
1124 local $TODO = 'not yet' unless $t->has_version('1.11.6'); 1121 local $TODO = 'not yet' unless $t->has_version('1.11.6');
1125 1122
1126 $s = Test::Nginx::HTTP2->new(port(8080)); 1123 $s = Test::Nginx::HTTP2->new(port(8080));
1127 $sid = $s->new_stream({ path => '/t1.html' }); 1124 $sid = $s->new_stream({ path => '/t1.html' });
1128 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); 1125 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
1129 1126
1130 kill 'HUP', $t->read_file('nginx.pid'); 1127 $t->reload();
1131 1128
1132 $frames = $s->read(all => [{ type => 'GOAWAY' }]); 1129 $frames = $s->read(all => [{ type => 'GOAWAY' }]);
1133 1130
1134 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; 1131 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
1135 is($frame->{last_sid}, $sid, 'GOAWAY with active stream - last sid'); 1132 is($frame->{last_sid}, $sid, 'GOAWAY with active stream - last sid');
1147 $frames = $s->read(all => [{ sid => $sid, fin => 0x1 }]); 1144 $frames = $s->read(all => [{ sid => $sid, fin => 0x1 }]);
1148 1145
1149 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames; 1146 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames;
1150 $sum = eval join '+', map { $_->{length} } @data; 1147 $sum = eval join '+', map { $_->{length} } @data;
1151 is($sum, 81, 'GOAWAY with active stream - active stream DATA after GOAWAY'); 1148 is($sum, 81, 'GOAWAY with active stream - active stream DATA after GOAWAY');
1152
1153 }
1154 1149
1155 # GOAWAY - force closing a connection by server with idle or active streams 1150 # GOAWAY - force closing a connection by server with idle or active streams
1156 1151
1157 $s = Test::Nginx::HTTP2->new(); 1152 $s = Test::Nginx::HTTP2->new();
1158 $sid = $s->new_stream(); 1153 $sid = $s->new_stream();