membphis commented on a change in pull request #2465:
URL: https://github.com/apache/apisix/pull/2465#discussion_r539416362
##########
File path: t/plugin/limit-conn.t
##########
@@ -1207,9 +1207,9 @@ qr/limit key: consumer_jackroute&consumer\d+/
content_by_lua_block {
local plugin = require("apisix.plugins.limit-conn")
local ok, err = plugin.check_schema({
- conn = 1,
- default_conn_delay = 0.1,
- rejected_code = 503,
+ conn = 1,
+ default_conn_delay = 0.1,
+ rejected_code = 503,
Review comment:
old test cases have `space` at the end of line.
my editor helps me do the `slim`, this is fine.

##########
File path: t/plugin/limit-conn.t
##########
@@ -1225,3 +1225,61 @@ property "burst" is required
done
--- no_error_log
[error]
+
+
+
+=== TEST 32: enable plugin: conn=1
+--- 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-conn": {
+ "conn": 1,
+ "burst": 0,
+ "default_conn_delay": 0.3,
+ "rejected_code": 503,
+ "key": "remote_addr"
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/hello"
+ }]]
+ )
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 33: hit route and should not be limited
+--- pipelined_requests eval
Review comment:
All requests are sent one after another, they are not concurrent.
So the request should never be limited for `"conn": 1,`.
In the old code, it will be limited due to this bug.
----------------------------------------------------------------
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:
[email protected]