Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lhanjian committed Jan 17, 2025
1 parent b9bde94 commit 76f5bac
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec/03-plugins/11-correlation-id/02-schema_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,34 +90,34 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
local rpc, rpc_sync = v[1], v[2]
describe("in hybrid mode" .. " rpc_sync=" .. rpc_sync, function()
local route
local plugin_name = "correlation-id"
local bp, db, ws, plugin_id
local plugin_name2 = "correlation-id"
local bp2, db2, ws2, plugin_id2

lazy_setup(function()
-- if the database is not cleared, the residual RPC connection information
-- between different tests will cause the test to fail.
bp, db = helpers.get_db_utils(strategy, { "plugins", "workspaces", })
ws = db.workspaces:select_by_name("default")
plugin_id = uuid.generate_v4()
bp2, db2 = helpers.get_db_utils(strategy, { "plugins", "workspaces", })
ws2 = db2.workspaces:select_by_name("default")
plugin_id2 = uuid.generate_v4()
local sql = render([[
INSERT INTO plugins (id, name, config, enabled, ws_id) VALUES
('$(ID)', '$(PLUGIN_NAME)', $(CONFIG)::jsonb, TRUE, '$(WS_ID)');
COMMIT;
]], {
ID = plugin_id,
PLUGIN_NAME = plugin_name,
ID = plugin_id2,
PLUGIN_NAME = plugin_name2,
CONFIG = pgmoon_json.encode_json(plugin_config),
WS_ID = ws.id,
WS_ID = ws2.id,
})

local res, err = db.connector:query(sql)
local res, err = db2.connector:query(sql)
assert.is_nil(err)
assert.is_not_nil(res)

route = bp.routes:insert({
route = bp2.routes:insert({
hosts = {"example.com"},
})
bp.plugins:insert {
bp2.plugins:insert {
name = "request-termination",
route = { id = route.id },
config = {
Expand All @@ -133,10 +133,10 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
]], {
ROUTE_ID = route.id,
--CACHE_KEY = "plugins:correlation-id:"..route.id.."::::"..ws.id,
CACHE_KEY = "plugins|"..ws.id.."|route|"..route.id.."|"..plugin_id,
ID = plugin_id,
CACHE_KEY = "plugins|"..ws2.id.."|route|"..route.id.."|"..plugin_id2,
ID = plugin_id2,
})
local _, err = db.connector:query(sql)
local _, err = db2.connector:query(sql)
assert.is_nil(err)

assert(helpers.start_kong({
Expand Down

0 comments on commit 76f5bac

Please sign in to comment.