AlinsRan commented on code in PR #13358:
URL: https://github.com/apache/apisix/pull/13358#discussion_r3533012745


##########
t/plugin/limit-count5.t:
##########
@@ -307,3 +307,47 @@ peek3: 3
 commit2: 0
 peek4: 0
 commit3: rejected
+
+
+
+=== TEST 9: error() call in gen_limit_key produces correct error message when 
parent is missing
+--- config
+    location /t {
+        content_by_lua_block {
+            local init = require("apisix.plugins.limit-count.init")
+            local conf = {
+                policy = "local",
+                count = 5,
+                time_window = 60,
+                key = "remote_addr",
+                key_type = "var",
+                rejected_code = 503,
+                allow_degradation = false,
+                show_limit_quota_header = true,
+                _meta = {}
+                -- _meta.parent is intentionally missing
+            }
+            local ctx = {
+                var = {remote_addr = "127.0.0.1"},
+                conf_version = 1,
+                conf_type = "route"
+            }
+            local ok, err = pcall(init.rate_limit, conf, ctx, "limit-count", 1)
+            if not ok then
+                -- error message should contain the JSON of parent (null)
+                if err:find("failed to generate key invalid parent") then

Review Comment:
   This is outdated now — I slimmed the PR down to just the DNS `error()` fix, 
so the only file left is `apisix/discovery/dns/init.lua`. The limit-count 
change and TEST 9 this comment refers to were dropped, nothing to assert here 
anymore. Resolving.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to