You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/01/06 14:48:53 UTC

[GitHub] [incubator-apisix] membphis commented on a change in pull request #976: Added password support for plugin limit-count-redis

membphis commented on a change in pull request #976: Added password support for plugin limit-count-redis
URL: https://github.com/apache/incubator-apisix/pull/976#discussion_r363323978
 
 

 ##########
 File path: t/plugin/limit-count-redis.t
 ##########
 @@ -209,3 +212,69 @@ passed
 [404, 503, 404, 503, 503]
 --- no_error_log
 [error]
+
+
+
+=== TEST 6: set route, with redis host, port and wrong password
+--- 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,
+                [[{
+                    "plugins": {
+                        "limit-count": {
+                            "count": 2,
+                            "time_window": 60,
+                            "rejected_code": 503,
+                            "key": "remote_addr",
+                            "policy": "redis",
+                            "redis_host": "127.0.0.1",
+                            "redis_port": 6379,
+                            "redis_timeout": 1001,
+                            "redis_password": "WRONG_foobared"
+                        }
+                    },
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:1980": 1
+                        },
+                        "type": "roundrobin"
+                    },
+                    "uri": "/hello_new"
+                }]]
+                )
+
+            if code >= 300 then
+                ngx.status = code
+            end
+            ngx.print(body)
+        }
+    }
+--- request
+GET /t
+--- error_code eval
+200
+--- no_error_log
+[error]
+
+
+
+=== TEST 7: request for TEST 6
+--- request
+GET /hello_new
+--- error_code eval
+500
+--- response_body
+{"1":"ERR invalid password","error_msg":"failed to limit count: "}
 
 Review comment:
   `"1":"ERR invalid password"`
   
   this is unacceptable, we need to fix it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services