diff --git a/kong-3.2.0-0.rockspec b/kong-3.2.0-0.rockspec index 21e721af7cf..15822bc1b5d 100644 --- a/kong-3.2.0-0.rockspec +++ b/kong-3.2.0-0.rockspec @@ -41,7 +41,7 @@ dependencies = { "lua-resty-ipmatcher == 0.6.1", "lua-resty-acme == 0.10.1", "lua-resty-session == 4.0.0", - "lua-resty-timer-ng == 0.2.0", + "lua-resty-timer-ng == 0.2.2", } build = { type = "builtin", diff --git a/kong/api/routes/debug.lua b/kong/api/routes/debug.lua index 8b488113c20..a75c338d160 100644 --- a/kong/api/routes/debug.lua +++ b/kong/api/routes/debug.lua @@ -64,6 +64,10 @@ local function handle_put_log_level(self, broadcast) return kong.response.exit(500, { message = message }) end + -- store in global _G table for timers pre-created by lua-resty-timer-ng + -- KAG-457 - find a better way to make this work with lua-resty-timer-ng + _G.log_level = log_level + return kong.response.exit(200, { message = "log level changed" }) end diff --git a/spec/02-integration/04-admin_api/22-debug_spec.lua b/spec/02-integration/04-admin_api/22-debug_spec.lua index 6be83918081..b3b7cda86b4 100644 --- a/spec/02-integration/04-admin_api/22-debug_spec.lua +++ b/spec/02-integration/04-admin_api/22-debug_spec.lua @@ -21,6 +21,10 @@ describe("Admin API - Kong debug route with strategy #" .. strategy, function() paths = { "/" }, service = service_mockbin, }) + assert(bp.plugins:insert { + name = "datadog", + service = service_mockbin, + }) assert(helpers.start_kong { database = strategy, @@ -143,6 +147,19 @@ describe("Admin API - Kong debug route with strategy #" .. strategy, function() "(20:unable to get local issuer certificate) " .. "while SSL handshaking to upstream", true, 2) + -- e2e test: we are not printing lower than alert + helpers.clean_logfile() + res = assert(helpers.proxy_client():send { + method = "GET", + path = "/", + headers = { + Host = "mockbin.com", + }, + }) + assert.res_status(502, res) + -- from timers pre-created by timer-ng (datadog plugin) + assert.logfile().has.no.line("failed to send data to", true, 2) + -- go back to default (debug) res = assert(helpers.admin_client():send { method = "PUT", @@ -179,6 +196,19 @@ describe("Admin API - Kong debug route with strategy #" .. strategy, function() assert.logfile().has.line("upstream SSL certificate verify error: " .. "(20:unable to get local issuer certificate) " .. "while SSL handshaking to upstream", true, 30) + + -- e2e test: we are printing higher than debug + helpers.clean_logfile() + res = assert(helpers.proxy_client():send { + method = "GET", + path = "/", + headers = { + Host = "mockbin.com", + }, + }) + assert.res_status(502, res) + -- from timers pre-created by timer-ng (datadog plugin) + assert.logfile().has.line("failed to send data to", true, 30) end) it("changes log level for traditional mode", function()