Mercurial > hg > nginx-tests
comparison stream_js.t @ 1247:edf5a3c9e36a
Tests: added tests for js backtraces.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Mon, 20 Nov 2017 20:23:24 +0300 |
parents | 4a825ec85c8d |
children | 70192b1baf01 |
comparison
equal
deleted
inserted
replaced
1246:ebaa2c72879d | 1247:edf5a3c9e36a |
---|---|
99 server { | 99 server { |
100 listen 127.0.0.1:8091; | 100 listen 127.0.0.1:8091; |
101 js_access js_access_step; | 101 js_access js_access_step; |
102 js_preread js_preread_step; | 102 js_preread js_preread_step; |
103 js_filter js_filter_step; | 103 js_filter js_filter_step; |
104 proxy_pass 127.0.0.1:8090; | |
105 } | |
106 | |
107 server { | |
108 listen 127.0.0.1:8092; | |
109 js_filter js_filter_except; | |
104 proxy_pass 127.0.0.1:8090; | 110 proxy_pass 127.0.0.1:8090; |
105 } | 111 } |
106 } | 112 } |
107 | 113 |
108 EOF | 114 EOF |
172 sess.buffer = res; | 178 sess.buffer = res; |
173 return; | 179 return; |
174 } | 180 } |
175 res += '3'; | 181 res += '3'; |
176 } | 182 } |
183 | |
184 function js_filter_except(sess) { | |
185 sess.a.a; | |
186 } | |
187 | |
177 EOF | 188 EOF |
178 | 189 |
179 $t->run_daemon(\&stream_daemon, port(8090)); | 190 $t->run_daemon(\&stream_daemon, port(8090)); |
180 $t->try_run('no stream njs available')->plan(12); | 191 $t->try_run('no stream njs available')->plan(13); |
181 $t->waitforsocket('127.0.0.1:' . port(8090)); | 192 $t->waitforsocket('127.0.0.1:' . port(8090)); |
182 | 193 |
183 ############################################################################### | 194 ############################################################################### |
184 | 195 |
185 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1', | 196 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1', |
194 is(stream('127.0.0.1:' . port(8086))->read(), 'OK', 'js_access allow'); | 205 is(stream('127.0.0.1:' . port(8086))->read(), 'OK', 'js_access allow'); |
195 is(stream('127.0.0.1:' . port(8087))->read(), '', 'js_access deny'); | 206 is(stream('127.0.0.1:' . port(8087))->read(), '', 'js_access deny'); |
196 is(stream('127.0.0.1:' . port(8088))->io('xyz'), 'xyz', 'js_preread'); | 207 is(stream('127.0.0.1:' . port(8088))->io('xyz'), 'xyz', 'js_preread'); |
197 is(stream('127.0.0.1:' . port(8089))->io('x'), 'z', 'js_filter'); | 208 is(stream('127.0.0.1:' . port(8089))->io('x'), 'z', 'js_filter'); |
198 is(stream('127.0.0.1:' . port(8091))->io('0'), '01233', 'handlers order'); | 209 is(stream('127.0.0.1:' . port(8091))->io('0'), '01233', 'handlers order'); |
210 stream('127.0.0.1:' . port(8092))->io('x'); | |
199 | 211 |
200 $t->stop(); | 212 $t->stop(); |
201 | 213 |
202 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'stream js log'); | 214 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'stream js log'); |
215 ok(index($t->read_file('error.log'), 'at js_filter_except') > 0, | |
216 'stream js_filter backtrace'); | |
203 | 217 |
204 ############################################################################### | 218 ############################################################################### |
205 | 219 |
206 sub stream_daemon { | 220 sub stream_daemon { |
207 my $server = IO::Socket::INET->new( | 221 my $server = IO::Socket::INET->new( |