Skip to content

Commit

Permalink
chore(compatibility): This PR is to add a config compatibility test that
Browse files Browse the repository at this point in the history
should have been added in [#10400](#10400)
  • Loading branch information
liverpool8056 committed Apr 27, 2023
1 parent 13691a0 commit fe65e8c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions spec/01-unit/19-hybrid/03-compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,62 @@ describe("kong.clustering.compat", function()
end)
end)

for _, strategy in helpers.each_strategy() do
describe("check compat for entities those have `updated_at` field", function()
local bp, db, entity_names

setup(function()
-- excludes entities are not exported: clustering_data_planes, document_objects, files,
-- group_rbac_roles, groups, legacy_files, login_attempts, rbac_role_endpoints,
-- rbac_role_entities, rbac_roles, rbac_users
entity_names = {
"services",
"routes",
"ca_certificates",
"certificates",
"consumers",
"targets",
"upstreams",
"plugins",
"workspaces",
"snis",
}

local plugins_enabled = { "key-auth" }
bp, db = helpers.get_db_utils(strategy, entity_names, plugins_enabled)

for _, name in ipairs(entity_names) do
if name == "plugins" then
local plugin = {
name = "key-auth",
config = {
-- key_names has default value so we don't have to provide it
-- key_names = {}
}
}
bp[name]:insert(plugin)
elseif name == "routes" then
bp[name]:insert({ hosts = { "test1.test" }, })
else
bp[name]:insert()
end
end
end)

teardown(function()
for _, entity_name in ipairs(entity_names) do
db[entity_name]:truncate()
end
end)

it(function()
local config = { config_table = declarative.export_config() }
local has_update = compat.update_compatible_payload(config, "3.0.0", "test_")
assert.truthy(has_update)
end)
end)
end

describe("core entities compatible changes", function()
local config, db

Expand Down

0 comments on commit fe65e8c

Please sign in to comment.