spacewander commented on a change in pull request #4774:
URL: https://github.com/apache/apisix/pull/4774#discussion_r684768302



##########
File path: t/plugin/limit-count-redis-cluster.t
##########
@@ -377,3 +377,62 @@ code: 503
 code: 503
 --- no_error_log
 [error]
+
+
+
+=== TEST 10: set route, four redis nodes, no one is valid, with enable 
degradation switch
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body = t('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                [[{
+                    "uri": "/hello",
+                    "plugins": {
+                        "limit-count": {
+                            "count": 9999,
+                            "time_window": 60,
+                            "key": "http_x_real_ip",
+                            "policy": "redis-cluster",
+                            "degradation": true,
+                            "redis_cluster_nodes": [
+                                "127.0.0.1:8001",
+                                "127.0.0.1:8002",
+                                "127.0.0.1:8003",
+                                "127.0.0.1:8004"
+                            ],
+                            "redis_cluster_name": "redis-cluster-1"
+                        }
+                    },
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:1980": 1
+                        },
+                        "type": "roundrobin"
+                    }
+                }]]
+                )
+
+            if code >= 300 then
+                ngx.status = code
+            end
+            ngx.say(body)
+        }
+    }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 11: enable degradation switch for TEST 10
+--- request
+GET /hello
+--- error_code eval

Review comment:
       We don't need to check 200 code - it is checked by default

##########
File path: apisix/plugins/limit-conn.lua
##########
@@ -33,6 +33,7 @@ local schema = {
         rejected_code = {
             type = "integer", minimum = 200, maximum = 599, default = 503
         },
+        degradation = {type = "boolean", default = false}

Review comment:
       Would be better to use "allow_degradation"?




-- 
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