From 160a6aeec25629795bd8d9891a3b72ad7974267b Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 22 Aug 2024 16:56:53 +0800 Subject: [PATCH] reload_module misc --- spec/01-unit/19-hybrid/03-compat_spec.lua | 1 - spec/02-integration/05-proxy/01-proxy_spec.lua | 1 - spec/02-integration/05-proxy/02-router_spec.lua | 1 - spec/02-integration/05-proxy/06-ssl_spec.lua | 1 - .../05-proxy/10-balancer/06-stream_spec.lua | 1 - .../02-integration/05-proxy/18-upstream_tls_spec.lua | 1 - spec/02-integration/05-proxy/19-grpc_proxy_spec.lua | 1 - .../05-proxy/21-grpc_plugins_triggering_spec.lua | 1 - spec/02-integration/05-proxy/23-context_spec.lua | 1 - spec/02-integration/05-proxy/26-udp_spec.lua | 1 - .../05-proxy/28-stream_plugins_triggering_spec.lua | 1 - spec/helpers.lua | 12 +++++++++++- 12 files changed, 11 insertions(+), 12 deletions(-) diff --git a/spec/01-unit/19-hybrid/03-compat_spec.lua b/spec/01-unit/19-hybrid/03-compat_spec.lua index 52d6ec83e251..b2e16b071134 100644 --- a/spec/01-unit/19-hybrid/03-compat_spec.lua +++ b/spec/01-unit/19-hybrid/03-compat_spec.lua @@ -650,7 +650,6 @@ describe("kong.clustering.compat", function() package.loaded["kong.db.schema.entities.routes"] = nil package.loaded["kong.db.schema.entities.routes_subschemas"] = nil package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.clustering.compat"] = nil package.loaded["kong.db.declarative"] = nil diff --git a/spec/02-integration/05-proxy/01-proxy_spec.lua b/spec/02-integration/05-proxy/01-proxy_spec.lua index 7a81e3b78e03..6192d3ab4e64 100644 --- a/spec/02-integration/05-proxy/01-proxy_spec.lua +++ b/spec/02-integration/05-proxy/01-proxy_spec.lua @@ -151,7 +151,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/02-router_spec.lua b/spec/02-integration/05-proxy/02-router_spec.lua index 5a5dd5891a0f..aa52eaa13c6b 100644 --- a/spec/02-integration/05-proxy/02-router_spec.lua +++ b/spec/02-integration/05-proxy/02-router_spec.lua @@ -2682,7 +2682,6 @@ do helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/06-ssl_spec.lua b/spec/02-integration/05-proxy/06-ssl_spec.lua index ca85e0bac4a7..770300354419 100644 --- a/spec/02-integration/05-proxy/06-ssl_spec.lua +++ b/spec/02-integration/05-proxy/06-ssl_spec.lua @@ -43,7 +43,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/10-balancer/06-stream_spec.lua b/spec/02-integration/05-proxy/10-balancer/06-stream_spec.lua index 610a6914bd91..b898979d6ed4 100644 --- a/spec/02-integration/05-proxy/10-balancer/06-stream_spec.lua +++ b/spec/02-integration/05-proxy/10-balancer/06-stream_spec.lua @@ -11,7 +11,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/18-upstream_tls_spec.lua b/spec/02-integration/05-proxy/18-upstream_tls_spec.lua index 30c8eec05b0a..13789ccdaee8 100644 --- a/spec/02-integration/05-proxy/18-upstream_tls_spec.lua +++ b/spec/02-integration/05-proxy/18-upstream_tls_spec.lua @@ -84,7 +84,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua b/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua index 8523d6a0d864..bc578ffd744e 100644 --- a/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua +++ b/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua @@ -15,7 +15,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/21-grpc_plugins_triggering_spec.lua b/spec/02-integration/05-proxy/21-grpc_plugins_triggering_spec.lua index 39f171e8cea4..daaedb55d92c 100644 --- a/spec/02-integration/05-proxy/21-grpc_plugins_triggering_spec.lua +++ b/spec/02-integration/05-proxy/21-grpc_plugins_triggering_spec.lua @@ -15,7 +15,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/23-context_spec.lua b/spec/02-integration/05-proxy/23-context_spec.lua index bb97388e2015..f5e82e9e45ef 100644 --- a/spec/02-integration/05-proxy/23-context_spec.lua +++ b/spec/02-integration/05-proxy/23-context_spec.lua @@ -12,7 +12,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/26-udp_spec.lua b/spec/02-integration/05-proxy/26-udp_spec.lua index 0941a6a12e37..f0e342938223 100644 --- a/spec/02-integration/05-proxy/26-udp_spec.lua +++ b/spec/02-integration/05-proxy/26-udp_spec.lua @@ -14,7 +14,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/02-integration/05-proxy/28-stream_plugins_triggering_spec.lua b/spec/02-integration/05-proxy/28-stream_plugins_triggering_spec.lua index 5e5014773185..3bab5d24f02f 100644 --- a/spec/02-integration/05-proxy/28-stream_plugins_triggering_spec.lua +++ b/spec/02-integration/05-proxy/28-stream_plugins_triggering_spec.lua @@ -84,7 +84,6 @@ local function reload_router(flavor) helpers.setenv("KONG_ROUTER_FLAVOR", flavor) package.loaded["spec.helpers"] = nil - package.loaded["spec.details.misc"] = nil package.loaded["kong.global"] = nil package.loaded["kong.cache"] = nil package.loaded["kong.db"] = nil diff --git a/spec/helpers.lua b/spec/helpers.lua index 2355b739e75a..355a28dda0dd 100644 --- a/spec/helpers.lua +++ b/spec/helpers.lua @@ -6,10 +6,11 @@ -- @module spec.helpers local CONSTANTS = require("spec.details.constants") -local misc = require("spec.details.misc") + local PLUGINS_LIST + local consumers_schema_def = require "kong.db.schema.entities.consumers" local services_schema_def = require "kong.db.schema.entities.services" local plugins_schema_def = require "kong.db.schema.entities.plugins" @@ -49,6 +50,15 @@ local strip = require("kong.tools.string").strip local splitlines = require("pl.stringx").splitlines +local function reload_module(name) + package.loaded[name] = nil + return require(name) +end + + +local misc = reload_module("spec.details.misc") + + local conf = misc.conf local exec = misc.exec local kong_exec = misc.kong_exec