This is an automated email from the ASF dual-hosted git repository. spacewander pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push: new de9ea13 test: make key-auth-upstream-domain-node stable (#3666) de9ea13 is described below commit de9ea132845202bd79624ddb780096882d50288c Author: 罗泽轩 <spacewander...@gmail.com> AuthorDate: Thu Feb 25 13:07:18 2021 +0800 test: make key-auth-upstream-domain-node stable (#3666) --- t/plugin/key-auth-upstream-domain-node.t | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/t/plugin/key-auth-upstream-domain-node.t b/t/plugin/key-auth-upstream-domain-node.t index 2cc50da..3211c9e 100644 --- a/t/plugin/key-auth-upstream-domain-node.t +++ b/t/plugin/key-auth-upstream-domain-node.t @@ -14,6 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +BEGIN { + $ENV{CUSTOM_DNS_SERVER} = "127.0.0.1:1053"; +} + use t::APISIX 'no_plan'; repeat_each(1); @@ -80,7 +84,7 @@ passed -=== TEST 3: create route with plugin `limit-req`(upstream node contains domain) +=== TEST 3: create route with plugin `limit-count`(upstream node contains domain) --- config location /t { content_by_lua_block { @@ -89,16 +93,16 @@ passed ngx.HTTP_PUT, [[{ "plugins": { - "limit-req": { - "rate": 1, - "burst": 0, + "limit-count": { + "count": 1, + "time_window": 5, "rejected_code": 503, "key": "remote_addr" } }, "upstream": { "nodes": { - "www.apiseven.com:80": 1 + "ttl.test.local:1980": 1 }, "pass_host": "node", "type": "roundrobin" @@ -142,18 +146,18 @@ location /t { headers ) ngx.say("return: ", code) + ngx.sleep(1) end } } --- request GET /t --- response_body -return: 302 +return: 404 return: 503 return: 503 --- no_error_log [error] ---- timeout: 5 @@ -166,7 +170,7 @@ return: 503 ngx.HTTP_PUT, [[{ "nodes": { - "www.apiseven.com:80": 1 + "ttl.test.local:1980": 1 }, "pass_host": "node", "type": "roundrobin" @@ -188,7 +192,7 @@ passed -=== TEST 6: create route with plugin `limit-req`, and bind upstream via id +=== TEST 6: create route with plugin `limit-count`, and bind upstream via id --- config location /t { content_by_lua_block { @@ -197,9 +201,9 @@ passed ngx.HTTP_PUT, [[{ "plugins": { - "limit-req": { - "rate": 1, - "burst": 0, + "limit-count": { + "count": 1, + "time_window": 5, "rejected_code": 503, "key": "remote_addr" } @@ -250,9 +254,8 @@ location /t { --- request GET /t --- response_body -return: 302 +return: 404 return: 503 return: 503 --- no_error_log [error] ---- timeout: 5