comparison stream_js.t @ 1315:890516ca898a

Tests: reverted 3882f8f3b2bc to unbreak with njs 0.1.15.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 02 Apr 2018 19:47:17 +0300
parents 3882f8f3b2bc
children 0569baf0cc4a
comparison
equal deleted inserted replaced
1314:b6d941ff65f4 1315:890516ca898a
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-LOG"); 136 sess.log("SEE-THIS");
137 sess.warn("SEE-THIS-WARN");
138 sess.error("SEE-THIS-ERROR");
139 } 137 }
140 138
141 function js_access_allow(sess) { 139 function js_access_allow(sess) {
142 if (sess.remoteAddress.match('127.0.0.1')) { 140 if (sess.remoteAddress.match('127.0.0.1')) {
143 return sess.OK; 141 return sess.OK;
199 } 197 }
200 198
201 EOF 199 EOF
202 200
203 $t->run_daemon(\&stream_daemon, port(8090)); 201 $t->run_daemon(\&stream_daemon, port(8090));
204 $t->try_run('no stream njs available')->plan(16); 202 $t->try_run('no stream njs available')->plan(14);
205 $t->waitforsocket('127.0.0.1:' . port(8090)); 203 $t->waitforsocket('127.0.0.1:' . port(8090));
206 204
207 ############################################################################### 205 ###############################################################################
208 206
209 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1', 207 is(stream('127.0.0.1:' . port(8080))->read(), 'addr=127.0.0.1',
223 stream('127.0.0.1:' . port(8092))->io('x'); 221 stream('127.0.0.1:' . port(8092))->io('x');
224 stream('127.0.0.1:' . port(8093))->io('x'); 222 stream('127.0.0.1:' . port(8093))->io('x');
225 223
226 $t->stop(); 224 $t->stop();
227 225
228 ok(index($t->read_file('error.log'), 'SEE-THIS-LOG') > 0, 'stream js log'); 226 ok(index($t->read_file('error.log'), 'SEE-THIS') > 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');
231 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, 227 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0,
232 'stream js_preread backtrace'); 228 'stream js_preread backtrace');
233 ok(index($t->read_file('error.log'), 'at js_filter_except') > 0, 229 ok(index($t->read_file('error.log'), 'at js_filter_except') > 0,
234 'stream js_filter backtrace'); 230 'stream js_filter backtrace');
235 231