From 6cb6899c75b70370fac89f5dc47e246ef5c19ab7 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 17 May 2024 18:11:13 -0300 Subject: [PATCH] tests(proxy-wasm) dispatch interrupted by a local response --- .github/workflows/ci.yml | 2 +- .../133-proxy_dispatch_http_edge_cases.t | 23 +++++++++++++++++++ .../hostcalls/src/types/test_http.rs | 6 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c92ed185b..ad927040a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t b/t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t index a9c41c2da..8d6d4530a 100644 --- a/t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t +++ b/t/03-proxy_wasm/hfuncs/133-proxy_dispatch_http_edge_cases.t @@ -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] diff --git a/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs b/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs index ace8a7381..b50b1eb27 100644 --- a/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs +++ b/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs @@ -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),