Skip to content

Commit

Permalink
tests(clustering/rpc): enable 09-hybrid_mode/01-sync_spec.lua for inc…
Browse files Browse the repository at this point in the history
…remental sync (#13959)

KAG-5951
  • Loading branch information
chobits authored Dec 2, 2024
1 parent f345fb5 commit fb99349
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions spec/02-integration/09-hybrid_mode/01-sync_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "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 @@ -264,20 +260,22 @@ describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, functi
headers = {["Content-Type"] = "application/json"}
}))
assert.res_status(200, res)
-- as this is testing a negative behavior, there is no sure way to wait
-- this can probably be optimizted
ngx.sleep(2)

local proxy_client = helpers.http_client("127.0.0.1", 9002)
helpers.wait_until(function()
local proxy_client = helpers.http_client("127.0.0.1", 9002)

-- test route again
res = assert(proxy_client:send({
method = "GET",
path = "/soon-to-be-disabled",
}))
assert.res_status(404, res)
-- test route again
res = assert(proxy_client:send({
method = "GET",
path = "/soon-to-be-disabled",
}))

proxy_client:close()
local status = res and res.status
proxy_client:close()
if status == 404 then
return true
end
end)
end)

it('does not sync plugins on a route attached to a disabled service', function()
Expand Down Expand Up @@ -742,7 +740,7 @@ describe("CP/DP config sync #" .. strategy .. " inc_sync=" .. inc_sync, function
end)
end)

skip_inc_sync("CP/DP labels #" .. strategy, function()
describe("CP/DP labels #" .. strategy, function()

lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations
Expand Down Expand Up @@ -797,8 +795,12 @@ skip_inc_sync("CP/DP labels #" .. strategy, function()
assert.matches("^(%d+%.%d+)%.%d+", v.version)
assert.equal(CLUSTERING_SYNC_STATUS.NORMAL, v.sync_status)
assert.equal(CLUSTERING_SYNC_STATUS.NORMAL, v.sync_status)
assert.equal("mycloud", v.labels.deployment)
assert.equal("us-east-1", v.labels.region)
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
assert.equal("mycloud", v.labels.deployment)
assert.equal("us-east-1", v.labels.region)
end
return true
end
end
Expand All @@ -807,7 +809,7 @@ skip_inc_sync("CP/DP labels #" .. strategy, function()
end)
end)

skip_inc_sync("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations

Expand Down Expand Up @@ -857,7 +859,11 @@ skip_inc_sync("CP/DP cert details(cluster_mtls = shared) #" .. strategy, functio

for _, v in pairs(json.data) do
if v.ip == "127.0.0.1" then
assert.equal(1888983905, v.cert_details.expiry_timestamp)
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
assert.equal(1888983905, v.cert_details.expiry_timestamp)
end
return true
end
end
Expand All @@ -866,7 +872,7 @@ skip_inc_sync("CP/DP cert details(cluster_mtls = shared) #" .. strategy, functio
end)
end)

skip_inc_sync("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations

Expand Down Expand Up @@ -922,7 +928,11 @@ skip_inc_sync("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()

for _, v in pairs(json.data) do
if v.ip == "127.0.0.1" then
assert.equal(1897136778, v.cert_details.expiry_timestamp)
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
assert.equal(1897136778, v.cert_details.expiry_timestamp)
end
return true
end
end
Expand Down

1 comment on commit fb99349

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:fb9934905251f899e57701ffcabf56eaf41d36f1
Artifacts available https://github.com/Kong/kong/actions/runs/12113759113

Please sign in to comment.