Skip to content

Commit

Permalink
get_dcbp & get_plugins_list
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Sep 4, 2024
1 parent 3d3cb0e commit 08deb58
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
17 changes: 15 additions & 2 deletions spec/details/db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,29 @@ local function get_cache(db)
end


local function get_dcbp()
return dcbp
end


local function get_plugins_list()
return PLUGINS_LIST
end


return {
PLUGINS_LIST = PLUGINS_LIST,
--PLUGINS_LIST = PLUGINS_LIST,

db = db,
blueprints = blueprints,
dcbp = dcbp,
--dcbp = dcbp,

get_cache = get_cache,
get_db_utils = get_db_utils,

get_dcbp = get_dcbp,
get_plugins_list = get_plugins_list,

truncate_tables = truncate_tables,
bootstrap_database = bootstrap_database,

Expand Down
11 changes: 4 additions & 7 deletions spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ end
---------------
local config_yml

local PLUGINS_LIST = DB.PLUGINS_LIST
local db = DB.db
local dcbp = DB.dcbp
local truncate_tables = DB.truncate_tables

-----------------
-- Custom helpers
-----------------
Expand Down Expand Up @@ -3225,7 +3220,7 @@ local function start_kong(env, tables, preserve_prefix, fixtures)
local ok, err = prepare_prefix(prefix)
if not ok then return nil, err end

truncate_tables(db, tables)
DB.truncate_tables(DB.db, tables)

local nginx_conf = ""
local nginx_conf_flags = { "test" }
Expand All @@ -3244,6 +3239,7 @@ local function start_kong(env, tables, preserve_prefix, fixtures)
nginx_conf_flags = ""
end

local dcbp = DB.get_dcbp()
if dcbp and not env.declarative_config and not env.declarative_config_string then
if not config_yml then
config_yml = prefix .. "/config.yml"
Expand Down Expand Up @@ -3547,7 +3543,7 @@ local function clustering_client(opts)
end
local payload = assert(cjson.encode({ type = "basic_info",
plugins = opts.node_plugins_list or
PLUGINS_LIST,
DB.get_plugins_list(),
labels = opts.node_labels,
process_conf = opts.node_process_conf,
}))
Expand Down Expand Up @@ -3885,6 +3881,7 @@ end
end,
-- returns the plugins and version list that is used by Hybrid mode tests
get_plugins_list = function()
local PLUGINS_LIST = DB.get_plugins_list()
assert(PLUGINS_LIST, "plugin list has not been initialized yet, " ..
"you must call get_db_utils first")
return table_clone(PLUGINS_LIST)
Expand Down

0 comments on commit 08deb58

Please sign in to comment.