From 3ff5eb8e698f45c592f5faf801a0813c8642db9d Mon Sep 17 00:00:00 2001 From: Murillo <103451714+gruceo@users.noreply.github.com> Date: Fri, 16 Aug 2024 08:43:57 -0300 Subject: [PATCH] 3.8 CP config is not refused by 3.6.1 DP --- kong/clustering/compat/checkers.lua | 4 +- .../09-hybrid_mode/09-config-compat_spec.lua | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/kong/clustering/compat/checkers.lua b/kong/clustering/compat/checkers.lua index 1ca9f7257df2..6504b18add73 100644 --- a/kong/clustering/compat/checkers.lua +++ b/kong/clustering/compat/checkers.lua @@ -47,13 +47,13 @@ local compatible_checkers = { local config = plugin.config if config.storage_config.redis.username ~= nil then log_warn_message('configures ' .. plugin.name .. ' plugin with redis username', - 'not work in this release.', + 'not work in this release', dp_version, log_suffix) end if config.storage_config.redis.password ~= nil then log_warn_message('configures ' .. plugin.name .. ' plugin with redis password', - 'not work in this release. Please use redis.auth config instead.', + 'not work in this release. Please use redis.auth config instead', dp_version, log_suffix) end end diff --git a/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua b/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua index 714fd2ba9861..5183a148d9bf 100644 --- a/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua +++ b/spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua @@ -337,6 +337,62 @@ describe("CP/DP config compat transformations #" .. strategy, function() describe("compatibility tests for redis standarization", function() describe("acme plugin", function() + it("translates standardized redis config to older acme structure", function() + -- [[ 3.8.x ]] -- + local acme = admin.plugins:insert { + name = "acme", + enabled = true, + config = { + account_email = "test@example.com", + storage = "redis", + storage_config = { + -- [[ new structure redis + redis = { + host = "localhost", + port = 57198, + username = "test", + password = "secret", + database = 2, + timeout = 1100, + ssl = true, + ssl_verify = true, + server_name = "example.test", + extra_options = { + namespace = "test_namespace", + scan_count = 13 + } + } + -- ]] + } + } + } + + local expected_acme_prior_38 = cycle_aware_deep_copy(acme) + expected_acme_prior_38.config.storage_config.redis = { + host = "localhost", + port = 57198, + username = "test", + auth = "secret", + password = "secret", + database = 2, + ssl = true, + ssl_verify = true, + ssl_server_name = "example.test", + namespace = "test_namespace", + scan_count = 13, + timeout = 1100, + server_name = "example.test", + extra_options = { + namespace = "test_namespace", + scan_count = 13 + } + } + do_assert(uuid(), "3.6.1", expected_acme_prior_38) + + -- cleanup + admin.plugins:remove({ id = acme.id }) + end) + it("translates standardized redis config to older acme structure", function() -- [[ 3.6.x ]] -- local acme = admin.plugins:insert {