comparison h2_limit_req.t @ 1020:196d33c2bb45

Tests: removed TODO and try_run() checks for legacy versions. Also removed now unused spdy.t and shmem prerequisite.
author Andrey Zelenkov <zelenkov@nginx.com>
date Wed, 31 Aug 2016 18:21:07 +0300
parents 882267679006
children efc502e696b0
comparison
equal deleted inserted replaced
1019:41139d6f8b7b 1020:196d33c2bb45
23 select STDERR; $| = 1; 23 select STDERR; $| = 1;
24 select STDOUT; $| = 1; 24 select STDOUT; $| = 1;
25 25
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite limit_req/) 26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite limit_req/)
27 ->plan(7); 27 ->plan(7);
28
29 $t->todo_alerts() unless $t->has_version('1.9.14');
30 28
31 $t->write_file_expand('nginx.conf', <<'EOF'); 29 $t->write_file_expand('nginx.conf', <<'EOF');
32 30
33 %%TEST_GLOBALS%% 31 %%TEST_GLOBALS%%
34 32
79 77
80 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 78 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
81 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', 79 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST',
82 'request body - limit req'); 80 'request body - limit req');
83 81
84 TODO: {
85 local $TODO = 'not yet' unless $t->has_version('1.9.15');
86
87 $s = Test::Nginx::HTTP2->new(); 82 $s = Test::Nginx::HTTP2->new();
88 $sid = $s->new_stream({ path => '/proxy_limit_req/', body_more => 1 }); 83 $sid = $s->new_stream({ path => '/proxy_limit_req/', body_more => 1 });
89 select undef, undef, undef, 1.1; 84 select undef, undef, undef, 1.1;
90 $s->h2_body('TEST'); 85 $s->h2_body('TEST');
91 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); 86 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
92 87
93 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 88 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
94 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', 89 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST',
95 'request body - limit req - limited'); 90 'request body - limit req - limited');
96
97 }
98 91
99 # request body delayed in limit_req - with an empty DATA frame 92 # request body delayed in limit_req - with an empty DATA frame
100 # "zero size buf in output" alerts seen 93 # "zero size buf in output" alerts seen
101 94
102 $s = Test::Nginx::HTTP2->new(); 95 $s = Test::Nginx::HTTP2->new();
112 105
113 $sid = $s->new_stream(); 106 $sid = $s->new_stream();
114 my ($maxwin) = sort {$a <=> $b} $s->{streams}{$sid}, $s->{conn_window}; 107 my ($maxwin) = sort {$a <=> $b} $s->{streams}{$sid}, $s->{conn_window};
115 108
116 SKIP: { 109 SKIP: {
117 skip 'leaves coredump', 1 unless $t->has_version('1.9.7');
118 skip 'not enough window', 1 if $maxwin < 5; 110 skip 'not enough window', 1 if $maxwin < 5;
119 111
120 $s = Test::Nginx::HTTP2->new(); 112 $s = Test::Nginx::HTTP2->new();
121 $sid = $s->new_stream({ path => '/proxy_limit_req/', body => 'TEST2' }); 113 $sid = $s->new_stream({ path => '/proxy_limit_req/', body => 'TEST2' });
122 select undef, undef, undef, 1.1; 114 select undef, undef, undef, 1.1;
134 $s = Test::Nginx::HTTP2->new(); 126 $s = Test::Nginx::HTTP2->new();
135 127
136 SKIP: { 128 SKIP: {
137 skip 'not enough window', 1 if $maxwin < 4; 129 skip 'not enough window', 1 if $maxwin < 4;
138 130
139 TODO: {
140 todo_skip 'use-after-free', 1 unless $ENV{TEST_NGINX_UNSAFE}
141 or $t->has_version('1.9.12');
142
143 $sid = $s->new_stream({ path => '/limit_req', body => 'TEST', split => [61], 131 $sid = $s->new_stream({ path => '/limit_req', body => 'TEST', split => [61],
144 split_delay => 1.1 }); 132 split_delay => 1.1 });
145 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); 133 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
146 134
147 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 135 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
148 is($frame->{headers}->{':status'}, '200', 'discard body - limit req - limited'); 136 is($frame->{headers}->{':status'}, '200', 'discard body - limit req - limited');
149
150 }
151 137
152 } 138 }
153 139
154 $sid = $s->new_stream({ path => '/' }); 140 $sid = $s->new_stream({ path => '/' });
155 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); 141 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
161 # 'http request already closed while closing request' alert can be produced 147 # 'http request already closed while closing request' alert can be produced
162 148
163 SKIP: { 149 SKIP: {
164 skip 'not enough window', 1 if $maxwin < 4; 150 skip 'not enough window', 1 if $maxwin < 4;
165 151
166 TODO: {
167 todo_skip 'use-after-free', 1 unless $ENV{TEST_NGINX_UNSAFE}
168 or $t->has_version('1.9.12');
169
170 $s = Test::Nginx::HTTP2->new(); 152 $s = Test::Nginx::HTTP2->new();
171 $sid = $s->new_stream({ path => '/limit_req', body => 'TEST', split => [61], 153 $sid = $s->new_stream({ path => '/limit_req', body => 'TEST', split => [61],
172 abort => 1 }); 154 abort => 1 });
173 155
174 select undef, undef, undef, 1.1; 156 select undef, undef, undef, 1.1;
175 close $s->{socket}; 157 close $s->{socket};
176 158
177 pass('discard body - limit req - eof'); 159 pass('discard body - limit req - eof');
178
179 }
180 160
181 } 161 }
182 162
183 ############################################################################### 163 ###############################################################################
184 164