# HG changeset patch # User Dmitry Volyntsev # Date 1612354837 0 # Node ID cd35d4f44937ac8af93032be4672a4e5d5a57584 # Parent 43f31fe62dfd09d5cae2d3b0411dd04cb93406b2 Tests: fixed typo in stream_js.t introduced in fd7766ab0a69. In addition, tests were added to catch proper exit status. diff --git a/stream_js.t b/stream_js.t --- a/stream_js.t +++ b/stream_js.t @@ -70,6 +70,8 @@ stream { js_include test.js; + log_format status $server_port:$status; + server { listen 127.0.0.1:8080; return $js_addr; @@ -112,18 +114,21 @@ stream { listen 127.0.0.1:8087; js_access js_access_undecided; return OK; + access_log %%TESTDIR%%/status.log status; } server { listen 127.0.0.1:8088; js_access js_access_allow; return OK; + access_log %%TESTDIR%%/status.log status; } server { listen 127.0.0.1:8089; js_access js_access_deny; return OK; + access_log %%TESTDIR%%/status.log status; } server { @@ -255,12 +260,12 @@ EOF return; } - s.abort(); + s.deny(); } function js_access_deny(s) { if (s.remoteAddress.match('127.0.0.1')) { - s.abort(); + s.deny(); return; } @@ -354,7 +359,7 @@ EOF EOF $t->run_daemon(\&stream_daemon, port(8090)); -$t->try_run('no stream njs available')->plan(19); +$t->try_run('no stream njs available')->plan(22); $t->waitforsocket('127.0.0.1:' . port(8090)); ############################################################################### @@ -395,6 +400,11 @@ ok(index($t->read_file('error.log'), 'at ok(index($t->read_file('error.log'), 'at js_filter_except') > 0, 'stream js_filter backtrace'); +my @p = (port(8087), port(8088), port(8089)); +like($t->read_file('status.log'), qr/$p[0]:200/, 'status undecided'); +like($t->read_file('status.log'), qr/$p[1]:200/, 'status allow'); +like($t->read_file('status.log'), qr/$p[2]:403/, 'status deny'); + ############################################################################### sub stream_daemon {