Skip to content

Commit

Permalink
tests(proxy-wasm) dispatch interrupted by a local response
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed May 17, 2024
1 parent f8d284b commit 6cb6899
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ jobs:
ngx: 1.25.5
hup: no_hup
debug: debug
path: t/01-wasm
path: t/01-wasm t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t
# V8
- runtime: v8
v8: 12.0.267.17
Expand Down
23 changes: 23 additions & 0 deletions t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,26 @@ qr/\A\[error] .*? dispatch failed: tcp socket - Connection refused
[crit]
[emerg]
[alert]



=== TEST 12: proxy_wasm - dispatch_http_call() followed by a local response
--- valgrind
--- wasm_modules: hostcalls
--- config
location /t {
proxy_wasm hostcalls 'on=request_headers \
test=/t/dispatch_and_local_response \
host=127.0.0.1:1';
return 200;
}
--- error_code: 201
--- response_body
--- grep_error_log eval: qr/\[error\] .*? dispatch failed.*/
--- grep_error_log_out eval
qr/\A\[error] .*? dispatch failed: tcp socket - Connection refused
\[error] .*? dispatch failed: tcp socket - Connection refused\Z/
--- no_error_log
[crit]
[emerg]
[alert]
6 changes: 6 additions & 0 deletions t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ impl TestHttp {
return Action::Pause;
}

/* edge case: dispatch + local response */
"/t/dispatch_and_local_response" => {
self.send_http_dispatch(0);
test_send_status(self, 201)
}

/* shared memory */
"/t/shm/get_shared_data" => test_get_shared_data(self),
"/t/shm/set_shared_data" => test_set_shared_data(self),
Expand Down

0 comments on commit 6cb6899

Please sign in to comment.