Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlightIbuki committed Dec 18, 2024
1 parent 5438bcc commit 10b37a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
30 changes: 21 additions & 9 deletions spec/01-unit/19-hybrid/04-rpc_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,43 @@ local client = require("spec.helpers.rpc_mock.client")

describe("rpc v2", function()
describe("full sync pagination", function()
describe("server side #t", function()
describe("server side", function()
local server_mock
local port
lazy_setup(function()
server_mock = server.new()
assert(server_mock:start())

helpers.start_kong({
assert(helpers.start_kong({
database = "off",
role = "data_plane",
cluster_cert = "spec/fixtures/kong_spec.crt",
cluster_cert_key = "spec/fixtures/kong_spec.key",
cluster_rpc = "on",
-- cluster_rpc_listen = "localhost:" .. port,
cluster_rpc_sync = "on",
log_level = "debug",
})
server_mock = server.new()
assert(server_mock:start())
port = server_mock.listen
cluster_control_plane = "localhost:8005",
}))
end)
lazy_teardown(function()
server_mock:stop(true)

helpers.stop_kong(nil, true)
end)

it("works", function()
-- the initial sync is flaky. let's trigger a sync by creating a service
local admin_client = helpers.admin_client()
assert.res_status(201, admin_client:send {
method = "POST",
path = "/services/",
body = {
name = "mockbin",
url = "http://mockbin.org",
},
headers = {
["Content-Type"] = "application/json",
},
})

helpers.wait_until(function()
return server_mock.records and next(server_mock.records)
end,20)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/rpc_mock/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function _M.new(opts)
opts.prefix = opts.prefix or "servroot_rpc_tap"
opts.role = "control_plane"
opts.plugins = "bundled,rpc-proxy"
opts.listen = opts.listen or 8005
opts.listen = opts.listen or 8005 -- default clustering port
opts.cluster_listen = opts.cluster_listen or ("0.0.0.0:" .. opts.listen)
opts.mocks = opts.mocks or {}
opts.prehooks = opts.prehooks or {}
Expand Down

0 comments on commit 10b37a0

Please sign in to comment.