Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(clustering): enable rpc sync for correlation-id #14171

Merged
merged 14 commits into from
Jan 22, 2025
30 changes: 27 additions & 3 deletions spec/03-plugins/11-correlation-id/02-schema_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,33 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
end)
end)

--- XXX FIXME: enable rpc_sync = on
for _, rpc_sync in ipairs { "off" } do
for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
local rpc, rpc_sync = v[1], v[2]
describe("in hybrid mode" .. " rpc_sync=" .. rpc_sync, function()
local route

lazy_setup(function()
-- if the database is not cleared, the residual RPC connection information
-- between different tests will cause the test to fail.
local plugin_name = "correlation-id"
bp, db = helpers.get_db_utils(strategy, { "plugins", "workspaces", })
ws = db.workspaces:select_by_name("default")
plugin_id = 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,
CONFIG = pgmoon_json.encode_json(plugin_config),
WS_ID = ws.id,
})

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

route = bp.routes:insert({
hosts = {"example.com"},
})
Expand Down Expand Up @@ -124,6 +146,7 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
prefix = "servroot",
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_rpc_sync = rpc_sync,
}))

Expand All @@ -136,6 +159,7 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
cluster_control_plane = "127.0.0.1:9005",
proxy_listen = "0.0.0.0:9002",
status_listen = "127.0.0.1:9100",
cluster_rpc = rpc,
cluster_rpc_sync = rpc_sync,
}))
end)
Expand Down Expand Up @@ -186,5 +210,5 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
proxy_client:close()
end)
end)
end -- for rpc_sync
end -- for rpc, rpc_sync
end)
Loading