Mercurial > hg > nginx-tests
comparison stream_js.t @ 1310:3882f8f3b2bc
Tests: added njs extended logging tests.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Thu, 29 Mar 2018 17:01:31 +0300 |
parents | 70192b1baf01 |
children | 890516ca898a |
comparison
equal
deleted
inserted
replaced
1309:3eb1de7e3b41 | 1310:3882f8f3b2bc |
---|---|
131 function js_sess_unk(sess) { | 131 function js_sess_unk(sess) { |
132 return 'sess_unk=' + sess.unk; | 132 return 'sess_unk=' + sess.unk; |
133 } | 133 } |
134 | 134 |
135 function js_log(sess) { | 135 function js_log(sess) { |
136 sess.log("SEE-THIS"); | 136 sess.log("SEE-THIS-LOG"); |
137 sess.warn("SEE-THIS-WARN"); | |
138 sess.error("SEE-THIS-ERROR"); | |
137 } | 139 } |
138 | 140 |
139 function js_access_allow(sess) { | 141 function js_access_allow(sess) { |
140 if (sess.remoteAddress.match('127.0.0.1')) { | 142 if (sess.remoteAddress.match('127.0.0.1')) { |
141 return sess.OK; | 143 return sess.OK; |
197 } | 199 } |
198 | 200 |
199 EOF | 201 EOF |
200 | 202 |
201 $t->run_daemon(\&stream_daemon, port(8090)); | 203 $t->run_daemon(\&stream_daemon, port(8090)); |
202 $t->try_run('no stream njs available')->plan(14); | 204 $t->try_run('no stream njs available')->plan(16); |
203 $t->waitforsocket('127.0.0.1:' . port(8090)); | 205 $t->waitforsocket('127.0.0.1:' . port(8090)); |
204 | 206 |
205 ############################################################################### | 207 ############################################################################### |
206 | 208 |
207 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1', | 209 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1', |
221 stream('127.0.0.1:' . port(8092))->io('x'); | 223 stream('127.0.0.1:' . port(8092))->io('x'); |
222 stream('127.0.0.1:' . port(8093))->io('x'); | 224 stream('127.0.0.1:' . port(8093))->io('x'); |
223 | 225 |
224 $t->stop(); | 226 $t->stop(); |
225 | 227 |
226 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'stream js log'); | 228 ok(index($t->read_file('error.log'), 'SEE-THIS-LOG') > 0, 'stream js log'); |
229 ok(index($t->read_file('error.log'), 'SEE-THIS-WARN') > 0, 'stream js warn'); | |
230 ok(index($t->read_file('error.log'), 'SEE-THIS-ERROR') > 0, 'stream js error'); | |
227 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, | 231 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, |
228 'stream js_preread backtrace'); | 232 'stream js_preread backtrace'); |
229 ok(index($t->read_file('error.log'), 'at js_filter_except') > 0, | 233 ok(index($t->read_file('error.log'), 'at js_filter_except') > 0, |
230 'stream js_filter backtrace'); | 234 'stream js_filter backtrace'); |
231 | 235 |