From e41a61f0d72f72da1ce2c346b58075ebbf9a797a Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Thu, 5 Dec 2024 18:04:51 -0800 Subject: [PATCH] tests(busted): use lazy_ variants of setup/teardown helpers Our tests should pretty much always prefer lazy_setup/lazy_teardown so that these handlers are not executed when tests are filtered out. --- spec/01-unit/01-db/06-postgres_spec.lua | 4 +-- spec/01-unit/09-balancer/01-generic_spec.lua | 12 ++++---- .../09-balancer/02-least_connections_spec.lua | 2 +- .../03-consistent_hashing_spec.lua | 2 +- .../09-balancer/04-round_robin_spec.lua | 2 +- spec/01-unit/09-balancer/06-latency_spec.lua | 2 +- spec/01-unit/19-hybrid/03-compat_spec.lua | 4 +-- .../02-admin_gui_template_spec.lua | 8 +++--- .../30-new-dns-client/04-client_ipc_spec.lua | 4 +-- spec/02-integration/03-db/03-plugins_spec.lua | 8 +++--- .../03-db/09-query-semaphore_spec.lua | 4 +-- .../04-admin_api/13-plugin-endpoints_spec.lua | 4 +-- .../04-admin_api/20-timers_spec.lua | 2 +- .../04-admin_api/23-cors_spec.lua | 2 +- .../08-status_api/05-dns_client_spec.lua | 6 ++-- .../09-hybrid_mode/08-lazy_export_spec.lua | 8 +++--- spec/03-plugins/06-statsd/01-log_spec.lua | 8 +++--- .../01-header_transformer_spec.lua | 2 +- spec/03-plugins/26-prometheus/01-api_spec.lua | 8 +++--- .../26-prometheus/02-access_spec.lua | 20 ++++++------- .../26-prometheus/03-custom-serve_spec.lua | 4 +-- .../26-prometheus/04-status_api_spec.lua | 8 +++--- .../26-prometheus/05-metrics_spec.lua | 4 +-- .../06-hybrid-mode_metrics_spec.lua | 4 +-- .../03-plugins/26-prometheus/08-unit_spec.lua | 4 +-- .../27-aws-lambda/05-aws-serializer_spec.lua | 4 +-- .../31-proxy-cache/02-access_spec.lua | 4 +-- .../03-plugins/31-proxy-cache/03-api_spec.lua | 4 +-- .../31-proxy-cache/04-invalidations_spec.lua | 6 ++-- .../01-schema_spec.lua | 4 +-- .../02-access_spec.lua | 4 +-- .../03-dbless_spec.lua | 6 ++-- .../04-phases_spec.lua | 4 +-- .../34-zipkin/zipkin_no_endpoint_spec.lua | 4 +-- .../34-zipkin/zipkin_queue_spec.lua | 2 +- spec/03-plugins/34-zipkin/zipkin_spec.lua | 28 +++++++++---------- .../35-azure-functions/01-access_spec.lua | 4 +-- .../37-opentelemetry/03-propagation_spec.lua | 6 ++-- .../37-opentelemetry/06-regression_spec.lua | 6 ++-- spec/03-plugins/38-ai-proxy/01-unit_spec.lua | 12 ++++---- .../01-access_spec.lua | 4 +-- .../02-helper_spec.lua | 4 +-- .../41-ai-prompt-decorator/01-unit_spec.lua | 4 +-- .../42-ai-prompt-guard/01-unit_spec.lua | 4 +-- .../43-ai-prompt-template/01-unit_spec.lua | 2 +- 45 files changed, 126 insertions(+), 126 deletions(-) diff --git a/spec/01-unit/01-db/06-postgres_spec.lua b/spec/01-unit/01-db/06-postgres_spec.lua index 04382b144821..bed03543d4ca 100644 --- a/spec/01-unit/01-db/06-postgres_spec.lua +++ b/spec/01-unit/01-db/06-postgres_spec.lua @@ -119,7 +119,7 @@ describe("kong.db [#postgres] connector", function() -- connector in a new scope local connector - setup(function() + lazy_setup(function() local new_config = { pg_database = "kong", pg_max_concurrent_queries = 1, @@ -189,7 +189,7 @@ describe("kong.db [#postgres] connector", function() -- connector in a new scope local connector - setup(function() + lazy_setup(function() local new_config = { pg_database = "kong", pg_max_concurrent_queries = 2, diff --git a/spec/01-unit/09-balancer/01-generic_spec.lua b/spec/01-unit/09-balancer/01-generic_spec.lua index 78b9141d88b1..3c8bd7830c1d 100644 --- a/spec/01-unit/09-balancer/01-generic_spec.lua +++ b/spec/01-unit/09-balancer/01-generic_spec.lua @@ -155,7 +155,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro local snapshot - setup(function() + lazy_setup(function() _G.package.loaded["kong.resty.dns.client"] = nil -- make sure module is reloaded _G.package.loaded["kong.runloop.balancer.targets"] = nil -- make sure module is reloaded @@ -901,7 +901,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro describe("(SRV)", function() local srv_name = enable_new_dns_client and "_test._tcp.srvrecord.test" - or "srvrecord.test" + or "srvrecord.test" it("adding a host",function() dnsSRV({ { name = srv_name, target = "1.1.1.1", port = 9000, weight = 10 }, @@ -1479,7 +1479,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro { name = "getkong.test", address = "1.2.3.4" }, }) local srv_name = enable_new_dns_client and "_test._tcp.konghq.test" - or "konghq.test" + or "konghq.test" dnsSRV({ { name = srv_name, target = "getkong.test", port = 2, weight = 3 }, }) @@ -1514,7 +1514,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro { name = "getkong.test", address = "1.2.3.4" }, }) local srv_name = enable_new_dns_client and "_test._tcp.konghq.test" - or "konghq.test" + or "konghq.test" dnsSRV({ { name = srv_name, target = "getkong.test", port = 2, weight = 3 }, }) @@ -1531,7 +1531,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro describe("getpeer()", function() local srv_name = enable_new_dns_client and "_test._tcp.konghq.test" - or "konghq.test" + or "konghq.test" local b before_each(function() @@ -1735,7 +1735,7 @@ for _, algorithm in ipairs{ "consistent-hashing", "least-connections", "round-ro describe("status:", function() local srv_name = enable_new_dns_client and "_test._tcp.srvrecord.test" - or "srvrecord.test" + or "srvrecord.test" local b diff --git a/spec/01-unit/09-balancer/02-least_connections_spec.lua b/spec/01-unit/09-balancer/02-least_connections_spec.lua index 5426b3953a32..6c10ede4d8ef 100644 --- a/spec/01-unit/09-balancer/02-least_connections_spec.lua +++ b/spec/01-unit/09-balancer/02-least_connections_spec.lua @@ -161,7 +161,7 @@ describe("[least-connections]" .. (enable_new_dns_client and "[new dns]" or ""), local snapshot - setup(function() + lazy_setup(function() _G.busted_new_dns_client = enable_new_dns_client _G.package.loaded["kong.resty.dns.client"] = nil -- make sure module is reloaded diff --git a/spec/01-unit/09-balancer/03-consistent_hashing_spec.lua b/spec/01-unit/09-balancer/03-consistent_hashing_spec.lua index 0cd32a708cd9..0c8e4f6c482c 100644 --- a/spec/01-unit/09-balancer/03-consistent_hashing_spec.lua +++ b/spec/01-unit/09-balancer/03-consistent_hashing_spec.lua @@ -207,7 +207,7 @@ describe("[consistent_hashing]" .. (enable_new_dns_client and "[new dns]" or "") or "gelato.io" local snapshot - setup(function() + lazy_setup(function() _G.busted_new_dns_client = enable_new_dns_client _G.package.loaded["kong.resty.dns.client"] = nil -- make sure module is reloaded diff --git a/spec/01-unit/09-balancer/04-round_robin_spec.lua b/spec/01-unit/09-balancer/04-round_robin_spec.lua index 7318c8123aef..eddc2130f6d5 100644 --- a/spec/01-unit/09-balancer/04-round_robin_spec.lua +++ b/spec/01-unit/09-balancer/04-round_robin_spec.lua @@ -244,7 +244,7 @@ describe("[round robin balancer]", function() local snapshot - setup(function() + lazy_setup(function() _G.busted_new_dns_client = enable_new_dns_client _G.package.loaded["kong.resty.dns.client"] = nil -- make sure module is reloaded diff --git a/spec/01-unit/09-balancer/06-latency_spec.lua b/spec/01-unit/09-balancer/06-latency_spec.lua index dc90293506ff..4d2b5dc285da 100644 --- a/spec/01-unit/09-balancer/06-latency_spec.lua +++ b/spec/01-unit/09-balancer/06-latency_spec.lua @@ -159,7 +159,7 @@ describe("[latency]" .. (enable_new_dns_client and "[new dns]" or ""), function( local snapshot local old_var = ngx.var - setup(function() + lazy_setup(function() _G.busted_new_dns_client = enable_new_dns_client _G.package.loaded["kong.resty.dns.client"] = nil -- make sure module is reloaded diff --git a/spec/01-unit/19-hybrid/03-compat_spec.lua b/spec/01-unit/19-hybrid/03-compat_spec.lua index b2e16b071134..ec607fc3ef87 100644 --- a/spec/01-unit/19-hybrid/03-compat_spec.lua +++ b/spec/01-unit/19-hybrid/03-compat_spec.lua @@ -358,7 +358,7 @@ describe("kong.clustering.compat", function() describe("[#" .. strategy .. "]: check compat for entities those have `updated_at` field", function() local bp, db, entity_names - setup(function() + lazy_setup(function() -- excludes entities not exportable: clustering_data_planes, entity_names = { "services", @@ -394,7 +394,7 @@ describe("kong.clustering.compat", function() end end) - teardown(function() + lazy_teardown(function() for _, entity_name in ipairs(entity_names) do db[entity_name]:truncate() end diff --git a/spec/01-unit/29-admin_gui/02-admin_gui_template_spec.lua b/spec/01-unit/29-admin_gui/02-admin_gui_template_spec.lua index 7e44dc3abe2e..1359e89b3bba 100644 --- a/spec/01-unit/29-admin_gui/02-admin_gui_template_spec.lua +++ b/spec/01-unit/29-admin_gui/02-admin_gui_template_spec.lua @@ -55,7 +55,7 @@ describe("admin_gui template", function() }, } - setup(function() + lazy_setup(function() prefix_handler.prepare_prefixed_interface_dir("/usr/local/kong", "gui", conf) os.execute("mkdir -p " .. mock_prefix) assert(pl_path.isdir(mock_prefix)) @@ -135,7 +135,7 @@ describe("admin_gui template", function() }, } - setup(function() + lazy_setup(function() prefix_handler.prepare_prefixed_interface_dir("/usr/local/kong", "gui", conf) os.execute("mkdir -p " .. mock_prefix) assert(pl_path.isdir(mock_prefix)) @@ -177,7 +177,7 @@ describe("admin_gui template", function() local usr_interface_dir = "gui2" local usr_interface_path = usr_path .. "/" .. usr_interface_dir - setup(function() + lazy_setup(function() conf.prefix = mock_prefix if not pl_path.exists(usr_interface_path) then @@ -185,7 +185,7 @@ describe("admin_gui template", function() end end) - teardown(function() + lazy_teardown(function() if pl_path.exists(usr_interface_path) then assert(pl_path.rmdir(usr_interface_path)) end diff --git a/spec/01-unit/30-new-dns-client/04-client_ipc_spec.lua b/spec/01-unit/30-new-dns-client/04-client_ipc_spec.lua index 63f50a156eac..89d01b0c7f0a 100644 --- a/spec/01-unit/30-new-dns-client/04-client_ipc_spec.lua +++ b/spec/01-unit/30-new-dns-client/04-client_ipc_spec.lua @@ -13,7 +13,7 @@ end describe("[dns-client] inter-process communication:",function() local num_workers = 2 - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils("postgres", { "routes", "services", @@ -34,7 +34,7 @@ describe("[dns-client] inter-process communication:",function() })) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/02-integration/03-db/03-plugins_spec.lua b/spec/02-integration/03-db/03-plugins_spec.lua index febe2e8519d4..931ea28914ba 100644 --- a/spec/02-integration/03-db/03-plugins_spec.lua +++ b/spec/02-integration/03-db/03-plugins_spec.lua @@ -348,7 +348,7 @@ for _, strategy in helpers.each_strategy() do end) describe("with bad PRIORITY fails; ", function() - setup(function() + lazy_setup(function() local schema = {} package.loaded["kong.plugins.NaN_priority.schema"] = schema package.loaded["kong.plugins.NaN_priority.handler"] = { PRIORITY = 0/0, VERSION = "1.0" } @@ -358,7 +358,7 @@ for _, strategy in helpers.each_strategy() do package.loaded["kong.plugins.string_priority.handler"] = { PRIORITY = "abc", VERSION = "1.0" } end) - teardown(function() + lazy_teardown(function() package.loaded["kong.plugins.NaN_priority.schema"] = nil package.loaded["kong.plugins.NaN_priority.handler"] = nil package.loaded["kong.plugins.huge_negative.schema"] = nil @@ -394,7 +394,7 @@ for _, strategy in helpers.each_strategy() do end) describe("with bad VERSION fails; ", function() - setup(function() + lazy_setup(function() local schema = {} package.loaded["kong.plugins.no_version.schema"] = schema package.loaded["kong.plugins.no_version.handler"] = { PRIORITY = 1000, VERSION = nil } @@ -404,7 +404,7 @@ for _, strategy in helpers.each_strategy() do package.loaded["kong.plugins.number.handler"] = { PRIORITY = 1000, VERSION = 123 } end) - teardown(function() + lazy_teardown(function() package.loaded["kong.plugins.no_version.schema"] = nil package.loaded["kong.plugins.no_version.handler"] = nil package.loaded["kong.plugins.too_many.schema"] = nil diff --git a/spec/02-integration/03-db/09-query-semaphore_spec.lua b/spec/02-integration/03-db/09-query-semaphore_spec.lua index 94f42d3122c3..de9917636781 100644 --- a/spec/02-integration/03-db/09-query-semaphore_spec.lua +++ b/spec/02-integration/03-db/09-query-semaphore_spec.lua @@ -4,7 +4,7 @@ local cjson = require "cjson" describe("#postgres Postgres query locks", function() local client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils("postgres", { "plugins", }, { @@ -25,7 +25,7 @@ describe("#postgres Postgres query locks", function() client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/02-integration/04-admin_api/13-plugin-endpoints_spec.lua b/spec/02-integration/04-admin_api/13-plugin-endpoints_spec.lua index bdd637ffde4c..4945cdf3dccc 100644 --- a/spec/02-integration/04-admin_api/13-plugin-endpoints_spec.lua +++ b/spec/02-integration/04-admin_api/13-plugin-endpoints_spec.lua @@ -6,7 +6,7 @@ for _, strategy in helpers.each_strategy() do describe("Admin API endpoints added via plugins #" .. strategy, function() local client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "plugins", }, { @@ -25,7 +25,7 @@ describe("Admin API endpoints added via plugins #" .. strategy, function() client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/02-integration/04-admin_api/20-timers_spec.lua b/spec/02-integration/04-admin_api/20-timers_spec.lua index 65077054df0c..89b617c294e6 100644 --- a/spec/02-integration/04-admin_api/20-timers_spec.lua +++ b/spec/02-integration/04-admin_api/20-timers_spec.lua @@ -18,7 +18,7 @@ local client client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/02-integration/04-admin_api/23-cors_spec.lua b/spec/02-integration/04-admin_api/23-cors_spec.lua index 3826b052f60d..cf892f3c1009 100644 --- a/spec/02-integration/04-admin_api/23-cors_spec.lua +++ b/spec/02-integration/04-admin_api/23-cors_spec.lua @@ -16,7 +16,7 @@ describe("Admin API - CORS -", function() client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/02-integration/08-status_api/05-dns_client_spec.lua b/spec/02-integration/08-status_api/05-dns_client_spec.lua index a3e7108a5b9e..6ec268ad21a2 100644 --- a/spec/02-integration/08-status_api/05-dns_client_spec.lua +++ b/spec/02-integration/08-status_api/05-dns_client_spec.lua @@ -28,7 +28,7 @@ for _, strategy in helpers.each_strategy() do client = helpers.http_client("127.0.0.1", tcp_status_port, 20000) end) - teardown(function() + lazy_teardown(function() if client then client:close() end @@ -81,7 +81,7 @@ for _, strategy in helpers.each_strategy() do client = helpers.http_client("127.0.0.1", tcp_status_port, 20000) end) - teardown(function() + lazy_teardown(function() if client then client:close() end @@ -139,7 +139,7 @@ for _, strategy in helpers.each_strategy() do client = helpers.http_client("127.0.0.1", tcp_status_port, 20000) end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/02-integration/09-hybrid_mode/08-lazy_export_spec.lua b/spec/02-integration/09-hybrid_mode/08-lazy_export_spec.lua index bbeb3524842f..f417abf136a7 100644 --- a/spec/02-integration/09-hybrid_mode/08-lazy_export_spec.lua +++ b/spec/02-integration/09-hybrid_mode/08-lazy_export_spec.lua @@ -62,10 +62,10 @@ for _, strategy in helpers.each_strategy() do describe("lazy_export with #".. strategy .. " inc_sync=" .. inc_sync, function() describe("no DP", function () - setup(function() + lazy_setup(function() cp(strategy, rpc, inc_sync) end) - teardown(function () + lazy_teardown(function () helpers.stop_kong() end) it("test", function () @@ -80,11 +80,11 @@ describe("lazy_export with #".. strategy .. " inc_sync=" .. inc_sync, function() end) describe("only json DP", function() - setup(function() + lazy_setup(function() cp(strategy, rpc, inc_sync) json_dp(rpc, inc_sync) end) - teardown(function () + lazy_teardown(function () helpers.stop_kong("dp1") helpers.stop_kong() end) diff --git a/spec/03-plugins/06-statsd/01-log_spec.lua b/spec/03-plugins/06-statsd/01-log_spec.lua index 4df2c3633044..c8bc20a7579c 100644 --- a/spec/03-plugins/06-statsd/01-log_spec.lua +++ b/spec/03-plugins/06-statsd/01-log_spec.lua @@ -2125,7 +2125,7 @@ for _, strategy in helpers.each_strategy() do describe("Plugin: statsd (log) [#" .. strategy .. "]", function() local proxy_client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy) local consumer = bp.consumers:insert { @@ -2157,7 +2157,7 @@ for _, strategy in helpers.each_strategy() do end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end @@ -2206,7 +2206,7 @@ for _, strategy in helpers.each_strategy() do describe("Plugin: statsd (log) in batches [#" .. strategy .. "]", function() local proxy_client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy) local consumer = bp.consumers:insert { @@ -2239,7 +2239,7 @@ for _, strategy in helpers.each_strategy() do end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end diff --git a/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua b/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua index 7b384fbdb3d5..98913e7b439d 100644 --- a/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua +++ b/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua @@ -19,7 +19,7 @@ end describe("Plugin: response-transformer", function() local header_transformer - setup(function() + lazy_setup(function() _G.ngx = { headers_sent = false, diff --git a/spec/03-plugins/26-prometheus/01-api_spec.lua b/spec/03-plugins/26-prometheus/01-api_spec.lua index eaaaf605b71f..d8c51a7fcc6a 100644 --- a/spec/03-plugins/26-prometheus/01-api_spec.lua +++ b/spec/03-plugins/26-prometheus/01-api_spec.lua @@ -5,7 +5,7 @@ describe("Plugin: prometheus (API)",function() local admin_client describe("with no 'prometheus_metrics' shm defined", function() - setup(function() + lazy_setup(function() helpers.get_db_utils() assert(helpers.start_kong({ plugins = "bundled, prometheus", @@ -13,7 +13,7 @@ describe("Plugin: prometheus (API)",function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end @@ -41,7 +41,7 @@ describe("Plugin: prometheus (API)",function() end) describe("with 'prometheus_metrics' defined", function() - setup(function() + lazy_setup(function() helpers.get_db_utils() assert(helpers.start_kong({ plugins = "bundled, prometheus", @@ -49,7 +49,7 @@ describe("Plugin: prometheus (API)",function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end diff --git a/spec/03-plugins/26-prometheus/02-access_spec.lua b/spec/03-plugins/26-prometheus/02-access_spec.lua index 5292b101049d..0166fee61872 100644 --- a/spec/03-plugins/26-prometheus/02-access_spec.lua +++ b/spec/03-plugins/26-prometheus/02-access_spec.lua @@ -13,7 +13,7 @@ describe("Plugin: prometheus (access)", function() local proxy_client_grpc local proxy_client_grpcs - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local service = bp.services:insert { @@ -89,7 +89,7 @@ describe("Plugin: prometheus (access)", function() proxy_client_grpcs = helpers.proxy_client_grpcs() end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end @@ -316,7 +316,7 @@ end) describe("Plugin: prometheus (access) no stream listeners", function() local admin_client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() bp.plugins:insert { @@ -337,7 +337,7 @@ describe("Plugin: prometheus (access) no stream listeners", function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end @@ -376,7 +376,7 @@ describe("Plugin: prometheus (access) per-consumer metrics", function() local proxy_client local admin_client - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local service = bp.services:insert { @@ -428,7 +428,7 @@ describe("Plugin: prometheus (access) per-consumer metrics", function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end @@ -523,7 +523,7 @@ describe("Plugin: prometheus (access) granular metrics switch", function() local success_scrape = "" - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local service = bp.services:insert { @@ -567,7 +567,7 @@ describe("Plugin: prometheus (access) granular metrics switch", function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end @@ -619,7 +619,7 @@ describe("Plugin: prometheus (access) AI metrics", function() local admin_client local prometheus_plugin - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local fixtures = { @@ -727,7 +727,7 @@ describe("Plugin: prometheus (access) AI metrics", function() admin_client = helpers.admin_client() end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end diff --git a/spec/03-plugins/26-prometheus/03-custom-serve_spec.lua b/spec/03-plugins/26-prometheus/03-custom-serve_spec.lua index 4cefa165bbc3..aaa8927bc4d8 100644 --- a/spec/03-plugins/26-prometheus/03-custom-serve_spec.lua +++ b/spec/03-plugins/26-prometheus/03-custom-serve_spec.lua @@ -4,7 +4,7 @@ describe("Plugin: prometheus (custom server)",function() local proxy_client describe("with custom nginx server block", function() - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local service = bp.services:insert { @@ -39,7 +39,7 @@ describe("Plugin: prometheus (custom server)",function() proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end diff --git a/spec/03-plugins/26-prometheus/04-status_api_spec.lua b/spec/03-plugins/26-prometheus/04-status_api_spec.lua index 2fec1a089b03..6d5ec79bae98 100644 --- a/spec/03-plugins/26-prometheus/04-status_api_spec.lua +++ b/spec/03-plugins/26-prometheus/04-status_api_spec.lua @@ -24,7 +24,7 @@ describe("Plugin: prometheus (access via status API)", function() return assert.res_status(200, res) end - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local upstream_hc_off = bp.upstreams:insert({ @@ -184,7 +184,7 @@ describe("Plugin: prometheus (access via status API)", function() end end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -438,7 +438,7 @@ describe("Plugin: prometheus (access) granular metrics switch", function() local success_scrape = "" - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils() local service = bp.services:insert { @@ -483,7 +483,7 @@ describe("Plugin: prometheus (access) granular metrics switch", function() status_client = helpers.http_client("127.0.0.1", tcp_status_port, 20000) end) - teardown(function() + lazy_teardown(function() if proxy_client then proxy_client:close() end diff --git a/spec/03-plugins/26-prometheus/05-metrics_spec.lua b/spec/03-plugins/26-prometheus/05-metrics_spec.lua index 69e506aa80d0..461e27403a3d 100644 --- a/spec/03-plugins/26-prometheus/05-metrics_spec.lua +++ b/spec/03-plugins/26-prometheus/05-metrics_spec.lua @@ -31,7 +31,7 @@ for _, strategy in helpers.each_strategy() do local admin_ssl_client -- admin_ssl_client (lua-resty-http) does not support h2 local proxy_ssl_client -- proxy_ssl_client (lua-resty-http) does not support h2 - setup(function() + lazy_setup(function() bp = helpers.get_db_utils(strategy, {"services", "routes", "plugins"}) local mock_ssl_service = bp.services:insert{ @@ -103,7 +103,7 @@ for _, strategy in helpers.each_strategy() do end) - teardown(function() + lazy_teardown(function() if admin_ssl_client then admin_ssl_client:close() end diff --git a/spec/03-plugins/26-prometheus/06-hybrid-mode_metrics_spec.lua b/spec/03-plugins/26-prometheus/06-hybrid-mode_metrics_spec.lua index f664ee1c6cbf..5f35a3ec3e45 100644 --- a/spec/03-plugins/26-prometheus/06-hybrid-mode_metrics_spec.lua +++ b/spec/03-plugins/26-prometheus/06-hybrid-mode_metrics_spec.lua @@ -5,7 +5,7 @@ local tcp_status_port = helpers.get_available_port() describe("Plugin: prometheus (Hybrid Mode)", function() local status_client - setup(function() + lazy_setup(function() assert(helpers.start_kong { nginx_conf = "spec/fixtures/custom_nginx.template", plugins = "bundled", @@ -28,7 +28,7 @@ describe("Plugin: prometheus (Hybrid Mode)", function() end end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/26-prometheus/08-unit_spec.lua b/spec/03-plugins/26-prometheus/08-unit_spec.lua index b2ef97369a76..48f4b1612314 100644 --- a/spec/03-plugins/26-prometheus/08-unit_spec.lua +++ b/spec/03-plugins/26-prometheus/08-unit_spec.lua @@ -6,7 +6,7 @@ describe("Plugin: prometheus (unit)", function() local orig_ngx_get_phase = ngx.get_phase local orig_ngx_timer = ngx.timer - setup(function() + lazy_setup(function() ngx.shared = require("spec.fixtures.shm-stub") ngx.get_phase = function() -- luacheck: ignore return "init_worker" @@ -19,7 +19,7 @@ describe("Plugin: prometheus (unit)", function() prometheus = require("kong.plugins.prometheus.prometheus") end) - teardown(function() + lazy_teardown(function() ngx.shared = orig_ngx_shared ngx.get_phase = orig_ngx_get_phase -- luacheck: ignore ngx.timer = orig_ngx_timer -- luacheck: ignore diff --git a/spec/03-plugins/27-aws-lambda/05-aws-serializer_spec.lua b/spec/03-plugins/27-aws-lambda/05-aws-serializer_spec.lua index b4e90ac80034..e79d4fc586d6 100644 --- a/spec/03-plugins/27-aws-lambda/05-aws-serializer_spec.lua +++ b/spec/03-plugins/27-aws-lambda/05-aws-serializer_spec.lua @@ -16,7 +16,7 @@ describe("[AWS Lambda] aws-gateway input", function() end - setup(function() + lazy_setup(function() old_ngx = ngx local body_data _G.ngx = setmetatable({ @@ -41,7 +41,7 @@ describe("[AWS Lambda] aws-gateway input", function() }) end) - teardown(function() + lazy_teardown(function() -- make sure to drop the mocks package.loaded["kong.plugins.aws-lambda.request-util"] = nil ngx = old_ngx -- luacheck: ignore diff --git a/spec/03-plugins/31-proxy-cache/02-access_spec.lua b/spec/03-plugins/31-proxy-cache/02-access_spec.lua index 250b07a78302..d9938e5f6108 100644 --- a/spec/03-plugins/31-proxy-cache/02-access_spec.lua +++ b/spec/03-plugins/31-proxy-cache/02-access_spec.lua @@ -31,7 +31,7 @@ do strategy_opts = policy_config, }) - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(nil, nil, {"proxy-cache"}) strategy:flush(true) @@ -387,7 +387,7 @@ do end) - teardown(function() + lazy_teardown(function() if client then client:close() end diff --git a/spec/03-plugins/31-proxy-cache/03-api_spec.lua b/spec/03-plugins/31-proxy-cache/03-api_spec.lua index ac5268396fb9..ece5c22706b0 100644 --- a/spec/03-plugins/31-proxy-cache/03-api_spec.lua +++ b/spec/03-plugins/31-proxy-cache/03-api_spec.lua @@ -6,7 +6,7 @@ describe("Plugin: proxy-cache", function() local bp local proxy_client, admin_client, cache_key, plugin1, route1 - setup(function() + lazy_setup(function() bp = helpers.get_db_utils(nil, nil, {"proxy-cache"}) route1 = assert(bp.routes:insert { @@ -63,7 +63,7 @@ describe("Plugin: proxy-cache", function() proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/31-proxy-cache/04-invalidations_spec.lua b/spec/03-plugins/31-proxy-cache/04-invalidations_spec.lua index b40d8729a003..ae7baac84feb 100644 --- a/spec/03-plugins/31-proxy-cache/04-invalidations_spec.lua +++ b/spec/03-plugins/31-proxy-cache/04-invalidations_spec.lua @@ -26,7 +26,7 @@ describe("proxy-cache invalidations via: " .. strategy, function() local plugin2 local bp - setup(function() + lazy_setup(function() bp = helpers.get_db_utils(strategy, nil, {"proxy-cache"}) route1 = assert(bp.routes:insert { @@ -97,7 +97,7 @@ describe("proxy-cache invalidations via: " .. strategy, function() admin_client_2 = helpers.http_client("127.0.0.1", 9001) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong("servroot1") helpers.stop_kong("servroot2") end) @@ -119,7 +119,7 @@ describe("proxy-cache invalidations via: " .. strategy, function() describe("cache purge", function() local cache_key, cache_key2 - setup(function() + lazy_setup(function() -- prime cache entries on both instances local res_1 = get(client_1, "route-1.test") diff --git a/spec/03-plugins/33-serverless-functions/01-schema_spec.lua b/spec/03-plugins/33-serverless-functions/01-schema_spec.lua index c8c2f3db2315..4847694261a8 100644 --- a/spec/03-plugins/33-serverless-functions/01-schema_spec.lua +++ b/spec/03-plugins/33-serverless-functions/01-schema_spec.lua @@ -22,13 +22,13 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do describe("Plugin: " .. plugin_name .. string.format(" (by %s)", method) .. " schema", function() local schema - setup(function() + lazy_setup(function() schema = require("kong.plugins." .. plugin_name .. ".schema") spy.on(kong.log, "warn") end) - teardown(function() + lazy_teardown(function() kong.log.warn:revert() end) diff --git a/spec/03-plugins/33-serverless-functions/02-access_spec.lua b/spec/03-plugins/33-serverless-functions/02-access_spec.lua index a4c382071c0a..775dd9375474 100644 --- a/spec/03-plugins/33-serverless-functions/02-access_spec.lua +++ b/spec/03-plugins/33-serverless-functions/02-access_spec.lua @@ -114,7 +114,7 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do describe("Plugin: " .. plugin_name .. string.format(" (by %s)", method) .. " access", function() local client, admin_client - setup(function() + lazy_setup(function() local bp, db = helpers.get_db_utils() assert(db:truncate()) @@ -273,7 +273,7 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do })) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/33-serverless-functions/03-dbless_spec.lua b/spec/03-plugins/33-serverless-functions/03-dbless_spec.lua index 55c9a9617875..49a90130b7ac 100644 --- a/spec/03-plugins/33-serverless-functions/03-dbless_spec.lua +++ b/spec/03-plugins/33-serverless-functions/03-dbless_spec.lua @@ -13,14 +13,14 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do describe("Plugin: " .. plugin_name .. " (dbless)", function() local admin_client - setup(function() + lazy_setup(function() assert(helpers.start_kong({ nginx_conf = "spec/fixtures/custom_nginx.template", database = "off", })) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -47,7 +47,7 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do - name: "pre-function" config: access: - - | + - | kong.log.err("foo") kong.response.exit(418) ]] diff --git a/spec/03-plugins/33-serverless-functions/04-phases_spec.lua b/spec/03-plugins/33-serverless-functions/04-phases_spec.lua index 1c2610017444..a4e8db9bcb5e 100644 --- a/spec/03-plugins/33-serverless-functions/04-phases_spec.lua +++ b/spec/03-plugins/33-serverless-functions/04-phases_spec.lua @@ -21,7 +21,7 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do -- which is no longer a possibility after sandboxing pending("Plugin: " .. plugin_name, function() - setup(function() + lazy_setup(function() local bp, db = helpers.get_db_utils() assert(db:truncate()) @@ -56,7 +56,7 @@ for _, plugin_name in ipairs({ "pre-function", "post-function" }) do })) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/34-zipkin/zipkin_no_endpoint_spec.lua b/spec/03-plugins/34-zipkin/zipkin_no_endpoint_spec.lua index 0eb0f8cdd302..0f23f0bb9723 100644 --- a/spec/03-plugins/34-zipkin/zipkin_no_endpoint_spec.lua +++ b/spec/03-plugins/34-zipkin/zipkin_no_endpoint_spec.lua @@ -71,7 +71,7 @@ describe("http integration tests with zipkin server (no http_endpoint) [#" proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -236,7 +236,7 @@ describe("global plugin doesn't overwrites", function() proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/34-zipkin/zipkin_queue_spec.lua b/spec/03-plugins/34-zipkin/zipkin_queue_spec.lua index 4d396eb49bc8..1705cb5688ab 100644 --- a/spec/03-plugins/34-zipkin/zipkin_queue_spec.lua +++ b/spec/03-plugins/34-zipkin/zipkin_queue_spec.lua @@ -75,7 +75,7 @@ describe("queueing behavior", function() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/34-zipkin/zipkin_spec.lua b/spec/03-plugins/34-zipkin/zipkin_spec.lua index df9e45905554..de80bcabbcc7 100644 --- a/spec/03-plugins/34-zipkin/zipkin_spec.lua +++ b/spec/03-plugins/34-zipkin/zipkin_spec.lua @@ -193,7 +193,7 @@ for _, strategy in helpers.each_strategy() do describe("plugin configuration", function() local proxy_client, zipkin_client, service - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -243,7 +243,7 @@ for _, strategy in helpers.each_strategy() do zipkin_client = helpers.http_client(ZIPKIN_HOST, ZIPKIN_PORT) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -274,7 +274,7 @@ for _, strategy in helpers.each_strategy() do describe("serviceName configuration", function() local proxy_client, zipkin_client, service - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -310,7 +310,7 @@ for _, strategy in helpers.each_strategy() do zipkin_client = helpers.http_client(ZIPKIN_HOST, ZIPKIN_PORT) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -344,7 +344,7 @@ for _, strategy in helpers.each_strategy() do helpers.clean_logfile() -- prevent log assertions from poisoning each other. end) - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -428,7 +428,7 @@ for _, strategy in helpers.each_strategy() do proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -486,7 +486,7 @@ for _, strategy in helpers.each_strategy() do describe("http_response_header_for_traceid configuration", function() local proxy_client, service - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -522,7 +522,7 @@ for _, strategy in helpers.each_strategy() do proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -547,7 +547,7 @@ for _, strategy in helpers.each_strategy() do describe("http_span_name configuration", function() local proxy_client, zipkin_client, service - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -583,7 +583,7 @@ for _, strategy in helpers.each_strategy() do zipkin_client = helpers.http_client(ZIPKIN_HOST, ZIPKIN_PORT) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -865,7 +865,7 @@ describe("http integration tests with zipkin server [#" end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -1705,7 +1705,7 @@ for _, strategy in helpers.each_strategy() do end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -1785,7 +1785,7 @@ for _, strategy in helpers.each_strategy() do describe("Integration tests with instrumentations enabled", function() local proxy_client, zipkin_client, service - setup(function() + lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) service = bp.services:insert { @@ -1821,7 +1821,7 @@ for _, strategy in helpers.each_strategy() do zipkin_client = helpers.http_client(ZIPKIN_HOST, ZIPKIN_PORT) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/35-azure-functions/01-access_spec.lua b/spec/03-plugins/35-azure-functions/01-access_spec.lua index 05f5598aec8a..1be546829c2a 100644 --- a/spec/03-plugins/35-azure-functions/01-access_spec.lua +++ b/spec/03-plugins/35-azure-functions/01-access_spec.lua @@ -46,7 +46,7 @@ for _, strategy in helpers.each_strategy() do }, }) - setup(function() + lazy_setup(function() local _, db = helpers.get_db_utils(strategy, { "routes", "services", @@ -150,7 +150,7 @@ for _, strategy in helpers.each_strategy() do proxy_client:close() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() assert(mock:stop()) end) diff --git a/spec/03-plugins/37-opentelemetry/03-propagation_spec.lua b/spec/03-plugins/37-opentelemetry/03-propagation_spec.lua index dd34df4f1511..9b8a9d5a2c51 100644 --- a/spec/03-plugins/37-opentelemetry/03-propagation_spec.lua +++ b/spec/03-plugins/37-opentelemetry/03-propagation_spec.lua @@ -295,7 +295,7 @@ describe("propagation tests #" .. strategy .. proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -636,7 +636,7 @@ for _, sampling_rate in ipairs({1, 0, 0.5}) do proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) @@ -800,7 +800,7 @@ describe("propagation tests with enabled " .. instrumentation .. " instrumentati proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/37-opentelemetry/06-regression_spec.lua b/spec/03-plugins/37-opentelemetry/06-regression_spec.lua index 7c1c661cad51..8d8e17df3f72 100644 --- a/spec/03-plugins/37-opentelemetry/06-regression_spec.lua +++ b/spec/03-plugins/37-opentelemetry/06-regression_spec.lua @@ -3,7 +3,7 @@ local helpers = require "spec.helpers" for _, strategy in helpers.each_strategy() do describe("opentelemetry regression #" .. strategy, function() local bp - setup(function() + lazy_setup(function() bp = assert(helpers.get_db_utils(strategy, { "services", "routes", @@ -18,7 +18,7 @@ for _, strategy in helpers.each_strategy() do local mock1, mock2 local mock_port1, mock_port2 - setup(function() + lazy_setup(function() mock_port1 = helpers.get_available_port() mock_port2 = helpers.get_available_port() @@ -58,7 +58,7 @@ for _, strategy in helpers.each_strategy() do }) end) - teardown(function() + lazy_teardown(function() helpers.stop_kong() end) diff --git a/spec/03-plugins/38-ai-proxy/01-unit_spec.lua b/spec/03-plugins/38-ai-proxy/01-unit_spec.lua index 7c0814ad7c44..60991415af0a 100644 --- a/spec/03-plugins/38-ai-proxy/01-unit_spec.lua +++ b/spec/03-plugins/38-ai-proxy/01-unit_spec.lua @@ -870,13 +870,13 @@ describe(PLUGIN_NAME .. ": (unit)", function() describe("gemini tools", function() local gemini_driver - setup(function() + lazy_setup(function() _G._TEST = true package.loaded["kong.llm.drivers.gemini"] = nil gemini_driver = require("kong.llm.drivers.gemini") end) - - teardown(function() + + lazy_teardown(function() _G._TEST = nil end) @@ -935,13 +935,13 @@ describe(PLUGIN_NAME .. ": (unit)", function() describe("bedrock tools", function() local bedrock_driver - setup(function() + lazy_setup(function() _G._TEST = true package.loaded["kong.llm.drivers.bedrock"] = nil bedrock_driver = require("kong.llm.drivers.bedrock") end) - - teardown(function() + + lazy_teardown(function() _G._TEST = nil end) diff --git a/spec/03-plugins/39-reconfiguration-completion/01-access_spec.lua b/spec/03-plugins/39-reconfiguration-completion/01-access_spec.lua index 436256de6cd3..0d14e8b78533 100644 --- a/spec/03-plugins/39-reconfiguration-completion/01-access_spec.lua +++ b/spec/03-plugins/39-reconfiguration-completion/01-access_spec.lua @@ -122,7 +122,7 @@ describe("Reconfiguration completion detection plugin", function() proxy_client = helpers.proxy_client() end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end @@ -170,7 +170,7 @@ describe("Reconfiguration completion detection plugin", function() proxy_client = helpers.proxy_client("127.0.0.1", 9002) end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end diff --git a/spec/03-plugins/39-reconfiguration-completion/02-helper_spec.lua b/spec/03-plugins/39-reconfiguration-completion/02-helper_spec.lua index 0ecbd6a9be00..90f1a28d6c7e 100644 --- a/spec/03-plugins/39-reconfiguration-completion/02-helper_spec.lua +++ b/spec/03-plugins/39-reconfiguration-completion/02-helper_spec.lua @@ -99,7 +99,7 @@ describe("Reconfiguration completion detection helper", function() proxy_client, admin_client = helpers.make_synchronized_clients() end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end @@ -151,7 +151,7 @@ describe("Reconfiguration completion detection helper", function() proxy_client, admin_client = helpers.make_synchronized_clients({ proxy_client = make_proxy_client() }) end) - teardown(function() + lazy_teardown(function() if admin_client then admin_client:close() end diff --git a/spec/03-plugins/41-ai-prompt-decorator/01-unit_spec.lua b/spec/03-plugins/41-ai-prompt-decorator/01-unit_spec.lua index 95e078a61784..bffef51a6ce8 100644 --- a/spec/03-plugins/41-ai-prompt-decorator/01-unit_spec.lua +++ b/spec/03-plugins/41-ai-prompt-decorator/01-unit_spec.lua @@ -111,13 +111,13 @@ describe(PLUGIN_NAME .. ": (unit)", function() local access_handler - setup(function() + lazy_setup(function() _G._TEST = true package.loaded["kong.plugins.ai-prompt-decorator.filters.decorate-prompt"] = nil access_handler = require("kong.plugins.ai-prompt-decorator.filters.decorate-prompt") end) - teardown(function() + lazy_teardown(function() _G._TEST = nil end) diff --git a/spec/03-plugins/42-ai-prompt-guard/01-unit_spec.lua b/spec/03-plugins/42-ai-prompt-guard/01-unit_spec.lua index df6735a1a1de..532cee13cde0 100644 --- a/spec/03-plugins/42-ai-prompt-guard/01-unit_spec.lua +++ b/spec/03-plugins/42-ai-prompt-guard/01-unit_spec.lua @@ -58,13 +58,13 @@ describe(PLUGIN_NAME .. ": (unit)", function() local access_handler - setup(function() + lazy_setup(function() _G._TEST = true package.loaded["kong.plugins.ai-prompt-guard.filters.guard-prompt"] = nil access_handler = require("kong.plugins.ai-prompt-guard.filters.guard-prompt") end) - teardown(function() + lazy_teardown(function() _G._TEST = nil end) diff --git a/spec/03-plugins/43-ai-prompt-template/01-unit_spec.lua b/spec/03-plugins/43-ai-prompt-template/01-unit_spec.lua index 9ab4c53d4c1e..57ad67d31831 100644 --- a/spec/03-plugins/43-ai-prompt-template/01-unit_spec.lua +++ b/spec/03-plugins/43-ai-prompt-template/01-unit_spec.lua @@ -83,7 +83,7 @@ describe(PLUGIN_NAME .. ": (unit)", function() local templater - setup(function() + lazy_setup(function() templater = require("kong.plugins.ai-prompt-template.templater") end)