Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
casimiro committed Oct 2, 2023
1 parent 77492f4 commit b0826d9
Showing 1 changed file with 52 additions and 25 deletions.
77 changes: 52 additions & 25 deletions t/05-others/010-connection_drop.t
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -42,6 +42,7 @@ qr/#\d+ on_response_headers, 5 headers.*
[warn]
[error]
[crit]
[stub]
Expand All @@ -58,7 +59,7 @@ qq{
listen unix:$ENV{TEST_NGINX_UNIX_SOCKET};
location / {
return 201;
return 200;
}
}
}
Expand All @@ -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]"
]
Expand Down Expand Up @@ -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]",
]
Expand Down Expand Up @@ -190,15 +212,16 @@ wasm tcp socket closing/
[warn]
[error]
[crit]
[stub]
--- SKIP
=== 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
Expand All @@ -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
Expand All @@ -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]",
]

0 comments on commit b0826d9

Please sign in to comment.