You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/09/18 10:43:11 UTC
[apisix] branch master updated: test: before creating and deleting
routes in batches, clear all routes first (#2253)
This is an automated email from the ASF dual-hosted git repository.
membphis 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 03d818e test: before creating and deleting routes in batches, clear all routes first (#2253)
03d818e is described below
commit 03d818e175f7fe6f55135f4d2c979ceac7728229
Author: YuanSheng Wang <me...@gmail.com>
AuthorDate: Fri Sep 18 18:43:02 2020 +0800
test: before creating and deleting routes in batches, clear all routes first (#2253)
* test: set larger timeout.
---
t/node/healthcheck.t | 1 +
t/node/route-delete.t | 58 +++++++++++++++++++++++++++++++++++++++------------
2 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/t/node/healthcheck.t b/t/node/healthcheck.t
index 424d96f..b6e754f 100644
--- a/t/node/healthcheck.t
+++ b/t/node/healthcheck.t
@@ -695,6 +695,7 @@ GET /t
qr/^.*?\[warn\].*/
--- grep_error_log_out eval
qr/unhealthy TCP increment.*foo.com.*127.0.0.1:1988/
+--- timeout: 5
diff --git a/t/node/route-delete.t b/t/node/route-delete.t
index 2111198..4e05ca8 100644
--- a/t/node/route-delete.t
+++ b/t/node/route-delete.t
@@ -26,13 +26,36 @@ run_tests();
__DATA__
-=== TEST 1: create 130 routes + delete them
+=== TEST 1: clear all routes
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
- for i = 1, 130 do
+ for i = 1, 200 do
+ t('/apisix/admin/routes/' .. i, ngx.HTTP_DELETE)
+ end
+
+ ngx.say("done")
+ }
+ }
+--- request
+GET /t
+--- response_body
+done
+--- no_error_log
+[error]
+--- timeout: 5
+
+
+
+=== TEST 2: create 106 routes + delete them
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+
+ for i = 1, 106 do
local code, body = t('/apisix/admin/routes/' .. i,
ngx.HTTP_PUT,
[[{
@@ -47,7 +70,9 @@ __DATA__
)
end
- for i = 1, 130 do
+ ngx.sleep(0.5)
+
+ for i = 1, 106 do
local code, body = t('/apisix/admin/routes/' .. i,
ngx.HTTP_PUT,
[[{
@@ -62,13 +87,17 @@ __DATA__
)
end
- for i = 1, 130 do
+ ngx.sleep(0.5)
+
+ for i = 1, 106 do
local code, body = t('/apisix/admin/routes/' .. i,
ngx.HTTP_DELETE
)
end
- for i = 1, 130 do
+ ngx.sleep(0.5)
+
+ for i = 1, 106 do
local code, body = t('/apisix/admin/routes/' .. i,
ngx.HTTP_PUT,
[[{
@@ -83,7 +112,9 @@ __DATA__
)
end
- for i = 1, 130 do
+ ngx.sleep(0.5)
+
+ for i = 1, 106 do
local code, body = t('/apisix/admin/routes/' .. i,
ngx.HTTP_DELETE
)
@@ -98,12 +129,13 @@ GET /t
done
--- no_error_log
[error]
+--- wait: 1
--- grep_error_log eval
-qr/\w+ (data by key: 126)/
+qr/\w+ (data by key: 103)/
--- grep_error_log_out
-insert data by key: 126
-update data by key: 126
-delete data by key: 126
-insert data by key: 126
-delete data by key: 126
---- timeout: 20
+insert data by key: 103
+update data by key: 103
+delete data by key: 103
+insert data by key: 103
+delete data by key: 103
+--- timeout: 30