diff --git a/t/05-others/010-connection_drop.t b/t/05-others/010-connection_drop.t index 47d2f71c5..85cc1a910 100644 --- a/t/05-others/010-connection_drop.t +++ b/t/05-others/010-connection_drop.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -plan tests => repeat_each() * (blocks() * 4); +plan tests => repeat_each() * (blocks() * 5); run_tests(); @@ -42,6 +42,7 @@ qr/#\d+ on_response_headers, 5 headers.* [warn] [error] [crit] +[stub] @@ -58,7 +59,7 @@ qq{ listen unix:$ENV{TEST_NGINX_UNIX_SOCKET}; location / { - return 201; + return 200; } } } @@ -74,10 +75,13 @@ qq{ --- grep_error_log_out eval qr/\[info\] .*? on_done.* \[info\] .*? on_log.*/ ---- no_error_log -[warn] -[error] -[crit] +--- no_error_log eval +[ + qr/\[info\] .*? on_response.*/, + "[warn]", + "[error]", + "[crit]" +] @@ -122,33 +126,51 @@ qr/^\*\d+ .*? on_http_call_response \(id: \d+, status: 200[^*].* [warn] [error] [crit] +[stub] === TEST 4: client connection drop - proxy_wasm - send_local_response() If a client drops the connection immediately after sending an HTTP request, and a filter running on that request calls send_local_response(), -a response will be produced and all filters running on the sent request will -have their on_response_headers, on_response_body, on_log and on_done entrypoints -invoked. +a response will be produced; ---- wasm_modules: hostcalls +filters running on the same request and declared after the filter which called +send_local_response() will have their on_response_headers, on_response_body, +on_log and on_done entrypoints invoked; + +filters running on the same request and declared before the filter will have +only their on_response_body, on_log and on_done entrypoints invoked. + +--- wasm_modules: hostcalls on_phases --- config location /t { + proxy_wasm on_phases; proxy_wasm hostcalls 'test=/t/send_local_response/body'; + proxy_wasm on_phases; } --- shutdown --- ignore_response --- grep_error_log eval: qr/\[info\] .*? on_(response|log|done).*/ --- grep_error_log_out eval -qr/\[info\] .*? on_response_headers, 5 headers, eof: true.* -\[info\] .*? on_response_body, 12 bytes, eof: true.* -\[info\] .*? on_done.* -\[info\] .*? on_log.*/ ---- no_error_log -[warn] -[error] -[crit] +qr/.*\["hostcalls" #1\].* on_response_headers.* +.*\["on_phases" #2\].* on_response_headers.* +.*\["on_phases" #1\].* on_response_body.* +.*\["hostcalls" #1\].* on_response_body.* +.*\["on_phases" #2\].* on_response_body.* +.*\["on_phases" #1\].* on_done.* +.*\["on_phases" #1\].* on_log.* +.*\["hostcalls" #1\].* on_done.* +.*\["hostcalls" #1\].* on_log.* +.*\["on_phases" #2\].* on_done.* +.*\["on_phases" #2\].* on_log.*/ +--- no_error_log eval +[ + qr/.*\["on_phases" #1\].* on_response_headers.*/, + "[warn]", + "[error]", + "[crit]", +] @@ -190,6 +212,7 @@ wasm tcp socket closing/ [warn] [error] [crit] +[stub] --- SKIP @@ -197,8 +220,8 @@ wasm tcp socket closing/ === TEST 6: client connection drop - wasm_call & echo - body_filter If a client drops the connection immediately after sending an HTTP request, and that request is answered by the echo directive, -all wasm functions configured to execute on content/header_filter/body_filter -phases will be invoked. +wasm functions configured to execute on content/header_filter/body_filter phases +will be invoked. --- load_nginx_modules: ngx_http_echo_module --- wasm_modules: ngx_rust_tests @@ -221,13 +244,14 @@ qr/\[debug\] .* wasm ops calling "ngx_rust_tests.log_notice_hello" in "content" [warn] [error] [crit] +[stub] === TEST 7: client connection drop - wasm_call & proxy_pass - body_filter If a client drops the connection immediately after sending an HTTP request, and that request is proxied by proxy_pass, -all wasm functions configured to execute on content phase will be invoked. +wasm functions configured to execute in content phase will be invoked. --- load_nginx_modules: ngx_http_echo_module --- wasm_modules: ngx_rust_tests @@ -253,7 +277,10 @@ qq{ --- grep_error_log eval: qr/\[debug\] .*? \*\d wasm ops calling .* in .* phase.*/ --- grep_error_log_out eval qr/\[debug\] .* wasm ops calling "ngx_rust_tests.log_notice_hello" in "content" phase.*/ ---- no_error_log -[warn] -[error] -[crit] +--- no_error_log eval +[ + qr/\[debug\] .* wasm ops calling .* in "(header_filter|body_filter)" phase.*/, + "[warn]", + "[error]", + "[crit]", +]