From 7785eece9cd7e8c2579a1742723f64f060cc81a1 Mon Sep 17 00:00:00 2001 From: Xiaochen Wang Date: Tue, 17 Dec 2024 17:55:59 +0800 Subject: [PATCH] fix tags --- kong/db/strategies/off/init.lua | 8 ++++---- spec/02-integration/04-admin_api/14-tags_spec.lua | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kong/db/strategies/off/init.lua b/kong/db/strategies/off/init.lua index 4399965114d7..4117ff8516be 100644 --- a/kong/db/strategies/off/init.lua +++ b/kong/db/strategies/off/init.lua @@ -215,11 +215,11 @@ end -- ws_id here. local function page_for_tags(self, size, offset, options) -- /:entitiy?tags=:tags - -- search all key-values: |*|*| => actual item key + -- search all key-values: I||*| => actual item key if self.schema.name ~= "tags" then - local prefix = item_key_prefix(self.schema.name, "*") -- "|*|*|" + local prefix = item_key_prefix(self.schema.name, "*") -- "I||" local items, err, offset = page_for_prefix(self, prefix, size, offset, - options, true) + options) if not items then return nil, err end @@ -273,7 +273,7 @@ local function page_for_tags(self, size, offset, options) local rows, err rows, err, offset_token = page_for_prefix(self, prefix, size, offset_token, - options, true, dao.schema) + options, false, dao.schema) if not rows then return nil, err end diff --git a/spec/02-integration/04-admin_api/14-tags_spec.lua b/spec/02-integration/04-admin_api/14-tags_spec.lua index ff8247a6b4cf..9c08ed41cf9d 100644 --- a/spec/02-integration/04-admin_api/14-tags_spec.lua +++ b/spec/02-integration/04-admin_api/14-tags_spec.lua @@ -6,7 +6,8 @@ local cjson = require "cjson" -- This test we test on the correctness of the admin API response so that -- we can ensure the right function (page()) is executed. describe("Admin API - tags", function() - for _, strategy in helpers.all_strategies() do + -- for _, strategy in helpers.all_strategies() do + for _, strategy in ipairs({"off"}) do describe("/entities?tags= with DB: #" .. strategy, function() local client, bp @@ -156,7 +157,7 @@ describe("Admin API - tags", function() assert.equals("invalid option (tags: invalid filter syntax)", json.message) end) - it("returns the correct 'next' arg", function() + it("returns the correct 'next' arg #ttt", function() local tags_arg = 'tags=corp_%20a' local res = assert(client:send { method = "GET",