Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(wasm): testing Kong/ngx_wasm_module#546 #13102

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ATC_ROUTER=ffd11db657115769bf94f0c4f915f98300bc26b6 # 1.6.2
SNAPPY=23b3286820105438c5dbb9bc22f1bb85c5812c8a # 1.2.0

KONG_MANAGER=nightly
NGX_WASM_MODULE=91d447ffd0e9bb08f11cc69d1aa9128ec36b4526
NGX_WASM_MODULE=da0bb1726cd82e8e21ea1f93645fe1b06c2e6a28
WASMER=3.1.1
WASMTIME=19.0.0
V8=12.0.267.17
Expand Down
7 changes: 0 additions & 7 deletions kong/runloop/wasm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -945,13 +945,6 @@ function _M.attach(ctx)
return kong.response.error(500)
end
end

jit.off(proxy_wasm.start)
ok, err = proxy_wasm.start()
if not ok then
log(CRIT, "failed to execute ", chain.label, " filter chain for request: ", err)
return kong.response.error(500)
end
end
flrgh marked this conversation as resolved.
Show resolved Hide resolved


Expand Down
4 changes: 4 additions & 0 deletions spec/02-integration/20-wasm/01-admin-api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe("wasm admin API [#" .. strategy .. "]", function()
local service, route

lazy_setup(function()
helpers.clean_prefix()

require("kong.runloop.wasm").enable({
{ name = "tests",
path = FILTER_PATH .. "/tests.wasm",
Expand Down Expand Up @@ -547,6 +549,8 @@ describe("wasm admin API - wasm = off [#" .. strategy .. "]", function()
local service

lazy_setup(function()
helpers.clean_prefix()

bp, db = helpers.get_db_utils(strategy, {
"routes",
"services",
Expand Down
69 changes: 35 additions & 34 deletions spec/02-integration/20-wasm/04-proxy-wasm_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
database = strategy,
nginx_conf = "spec/fixtures/custom_nginx.template",
wasm = true,
wasm_filters = "tests",
dns_hostsfile = hosts_file,
plugins = "pre-function,post-function",
}))
Expand All @@ -152,7 +153,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()

describe("runs a filter chain", function()
it("with a single filter", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -166,7 +167,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("with multiple filters", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -182,7 +183,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()

describe("filters can", function()
it("add request headers", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -203,7 +204,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("remove request headers", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -223,7 +224,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("add response headers on_request_headers", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -243,7 +244,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("add response headers on_response_headers", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -266,7 +267,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
-- describe+it:
-- "filters can NOT ..."
it("NOT add response headers on_log", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -286,7 +287,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()

pending("throw a trap", function()
-- Used to work but now broken (obscure wasmtime SIGSEV), no clue
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -303,7 +304,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

pending("send a local response", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -322,7 +323,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.client.protocol", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -342,7 +343,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.nginx.subsystem", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -362,7 +363,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.node.id", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -382,7 +383,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.node.memory_stats", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -402,7 +403,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.request.forwarded_host", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -422,7 +423,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.request.forwarded_port", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -442,7 +443,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.request.forwarded_scheme", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -462,7 +463,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

pending("read kong.response.source", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -483,7 +484,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.router.route", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -504,7 +505,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.router.service", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -525,7 +526,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("write kong.service.target", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local target = helpers.mock_upstream_host .. ":" ..
Expand All @@ -551,7 +552,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
-- target is being set to mock_upstream:15555 instead of
-- 127.0.0.1:1555 as expected...
pending("write kong.service.upstream", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -572,7 +573,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("write kong.service.request.scheme", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -591,7 +592,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

pending("read kong.service.response.status", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -612,7 +613,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("write kong.response.status", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -633,7 +634,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.configuration", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -653,7 +654,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.route_id", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -673,7 +674,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.service_id", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -693,7 +694,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("read kong.ctx.shared[<attr>]", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -715,7 +716,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("write kong.ctx.shared[<attr>]", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -737,7 +738,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("clear kong.ctx.shared[<attr>]", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -759,7 +760,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

it("send an http dispatch, return its response body", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand Down Expand Up @@ -787,7 +788,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
end)

pending("resolves DNS hostnames to send an http dispatch, return its response body", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand Down Expand Up @@ -819,7 +820,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()

pending("start on_tick background timer", function()
-- Pending on internal ngx_wasm_module changes
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand All @@ -837,7 +838,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()

describe("behavior with", function()
pending("multiple filters, one sends a local response", function()
local client = helpers.proxy_client()
local client = helpers.proxy_client(5000)
finally(function() client:close() end)

local res = assert(client:send {
Expand Down
Loading