Skip to content

Commit

Permalink
fix some in 09-hybrid_mode/01-sync_spec.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Sep 26, 2024
1 parent 1e4fb24 commit c8feb0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _M:init_cp(manager)
last_seen = ngx.time(),
hostname = node_id,
ip = kong.rpc.client_ips[node_id], -- try to get the corret ip
version = "3.8.0.0",
version = "3.8.0.0", -- XXX TODO
sync_status = CLUSTERING_SYNC_STATUS.NORMAL,
config_hash = string.format("%032d", default_namespace.version),
rpc_capabilities = rpc_peers and rpc_peers[node_id] or {},
Expand Down
25 changes: 22 additions & 3 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,10 @@ local uuid = require("kong.tools.uuid").uuid
local KEY_AUTH_PLUGIN


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

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

lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations
Expand All @@ -27,6 +28,7 @@ describe("CP/DP communication #" .. strategy, function()
db_update_frequency = 0.1,
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_incremental_sync = inc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -38,6 +40,7 @@ describe("CP/DP communication #" .. strategy, function()
cluster_control_plane = "127.0.0.1:9005",
proxy_listen = "0.0.0.0:9002",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_incremental_sync = inc_sync,
}))

for _, plugin in ipairs(helpers.get_plugins_list()) do
Expand Down Expand Up @@ -263,7 +266,13 @@ describe("CP/DP communication #" .. strategy, function()
method = "GET",
path = "/soon-to-be-disabled",
}))
assert.res_status(404, res)

if inc_sync == "on" then
-- XXX incremental sync does not skip_disabled_services by default
assert.res_status(200, res)
else
assert.res_status(404, res)
end

proxy_client:close()
end)
Expand Down Expand Up @@ -357,6 +366,7 @@ describe("CP/DP #version check #" .. strategy, function()
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_version_check = "major_minor",
cluster_incremental_sync = inc_sync,
}))

for _, plugin in ipairs(helpers.get_plugins_list()) do
Expand Down Expand Up @@ -624,6 +634,7 @@ describe("CP/DP config sync #" .. strategy, function()
database = strategy,
db_update_frequency = 3,
cluster_listen = "127.0.0.1:9005",
cluster_incremental_sync = inc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -634,6 +645,7 @@ describe("CP/DP config sync #" .. strategy, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_control_plane = "127.0.0.1:9005",
proxy_listen = "0.0.0.0:9002",
cluster_incremental_sync = inc_sync,
}))
end)

Expand Down Expand Up @@ -736,6 +748,7 @@ describe("CP/DP labels #" .. strategy, function()
db_update_frequency = 0.1,
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_incremental_sync = inc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -748,6 +761,7 @@ describe("CP/DP labels #" .. strategy, function()
proxy_listen = "0.0.0.0:9002",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_dp_labels="deployment:mycloud,region:us-east-1",
cluster_incremental_sync = inc_sync,
}))
end)

Expand Down Expand Up @@ -796,6 +810,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
db_update_frequency = 0.1,
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_incremental_sync = inc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -808,6 +823,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
proxy_listen = "0.0.0.0:9002",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_dp_labels="deployment:mycloud,region:us-east-1",
cluster_incremental_sync = inc_sync,
}))
end)

Expand Down Expand Up @@ -854,6 +870,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
-- additional attributes for PKI:
cluster_mtls = "pki",
cluster_ca_cert = "spec/fixtures/kong_clustering_ca.crt",
cluster_incremental_sync = inc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -869,6 +886,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
cluster_mtls = "pki",
cluster_server_name = "kong_clustering",
cluster_ca_cert = "spec/fixtures/kong_clustering.crt",
cluster_incremental_sync = inc_sync,
}))
end)

Expand Down Expand Up @@ -900,4 +918,5 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
end)
end)

end
end -- for _, strategy
end -- for inc_sync

0 comments on commit c8feb0a

Please sign in to comment.