Skip to content

Commit

Permalink
fix(rpc): dao hooks of *_by are missed
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlightIbuki committed Nov 4, 2024
1 parent 4d89bd3 commit 9df5501
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
15 changes: 15 additions & 0 deletions kong/clustering/services/sync/hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ function _M:register_dao_hooks()
["dao:upsert:pre"] = pre_hook_func,
["dao:upsert:fail"] = fail_hook_func,
["dao:upsert:post"] = post_hook_writer_func,

-- dao:upsert_by
["dao:upsert_by:pre"] = pre_hook_func,
["dao:upsert_by:fail"] = fail_hook_func,
["dao:upsert_by:post"] = post_hook_writer_func,

-- dao:delete_by
["dao:delete_by:pre"] = pre_hook_func,
["dao:delete_by:fail"] = fail_hook_func,
["dao:delete_by:post"] = post_hook_delete_func,

-- dao:update_by
["dao:update_by:pre"] = pre_hook_func,
["dao:update_by:fail"] = fail_hook_func,
["dao:update_by:post"] = post_hook_writer_func,
}

for ev, func in pairs(dao_hooks) do
Expand Down
23 changes: 12 additions & 11 deletions spec/02-integration/09-hybrid_mode/01-sync_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ local uuid = require("kong.tools.uuid").uuid
local KEY_AUTH_PLUGIN


for _, inc_sync in ipairs { "on", "off" } do
for _, inc_sync in ipairs { "on" } do
for _, strategy in helpers.each_strategy() do

--- XXX FIXME: enable inc_sync = on
-- skips the rest of the tests. We will fix them in a follow-up PR
local skip_inc_sync = inc_sync == "on" and pending or describe

describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, function()

lazy_setup(function()
Expand Down Expand Up @@ -623,11 +627,7 @@ describe("CP/DP #version check #" .. strategy, function()
end)
end)

--- XXX FIXME: enable inc_sync = on
-- skips the rest of the tests. We will fix them in a follow-up PR
local skip_inc_sync = inc_sync == "on" and pending or describe

skip_inc_sync("CP/DP config sync #" .. strategy, function()
describe("CP/DP config sync #" .. strategy, function()
lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations

Expand Down Expand Up @@ -776,14 +776,15 @@ skip_inc_sync("CP/DP labels #" .. strategy, function()

describe("status API", function()
it("shows DP status", function()
helpers.wait_until(function()
local admin_client = helpers.admin_client()
finally(function()
admin_client:close()
end)
local admin_client = helpers.admin_client()
finally(function()
admin_client:close()
end)

helpers.wait_until(function()
local res = assert(admin_client:get("/clustering/data-planes"))
local body = assert.res_status(200, res)
print(body)
local json = cjson.decode(body)

for _, v in pairs(json.data) do
Expand Down

0 comments on commit 9df5501

Please sign in to comment.