This is an automated email from the ASF dual-hosted git repository.

tokers 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 da99a03  test: add more test to check if checker is stopped. (#3350)
da99a03 is described below

commit da99a03cbf42bc740ab53f5395e60cc8d5f8e5bc
Author: 罗泽轩 <[email protected]>
AuthorDate: Tue Jan 19 23:32:26 2021 -0600

    test: add more test to check if checker is stopped. (#3350)
    
    Signed-off-by: spacewander <[email protected]>
---
 t/node/healthcheck-stop-checker.t | 96 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/t/node/healthcheck-stop-checker.t 
b/t/node/healthcheck-stop-checker.t
index 161d244..e6105f0 100644
--- a/t/node/healthcheck-stop-checker.t
+++ b/t/node/healthcheck-stop-checker.t
@@ -137,3 +137,99 @@ qr/create new checker: table: 0x|try to release checker: 
table: 0x/
 create new checker: table: 0x
 try to release checker: table: 0x
 create new checker: table: 0x
+
+
+
+=== TEST 5: update + delete for /upstreams
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+
+            local code, _, body = t('/apisix/admin/upstreams/1',
+                "PUT",
+                
[[{"type":"roundrobin","nodes":{"127.0.0.1:1980":1,"127.0.0.1:1981":1},"checks":{"active":{"http_path":"/status","healthy":{"interval":1,"successes":1},"unhealthy":{"interval":1,"http_failures":2}}}}]]
+            )
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            -- release the clean handler of previous test
+            local code, _, body = t('/apisix/admin/routes/1',
+                "PUT",
+                [[{"uri":"/server_port","upstream_id":1}]]
+            )
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.sleep(0.2)
+            code, _, body = t('/server_port', "GET")
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.sleep(0.5)
+
+            -- update
+            code, _, body = t('/apisix/admin/upstreams/1',
+                "PUT",
+                
[[{"type":"roundrobin","nodes":{"127.0.0.1:1980":1,"127.0.0.1:1981":1},"checks":{"active":{"http_path":"/void","healthy":{"interval":1,"successes":1},"unhealthy":{"interval":1,"http_failures":1}}}}]]
+            )
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.sleep(0.2)
+            code, _, body = t('/server_port', "GET")
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            -- delete
+            code, _, body = t('/apisix/admin/routes/1', "DELETE")
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            code, _, body = t('/apisix/admin/upstreams/1', "DELETE")
+
+            if code > 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.say("ok")
+        }
+    }
+--- request
+GET /t
+--- response_body
+ok
+--- grep_error_log eval
+qr/create new checker: table: 0x|try to release checker: table: 0x/
+--- grep_error_log_out
+try to release checker: table: 0x
+create new checker: table: 0x
+try to release checker: table: 0x
+create new checker: table: 0x
+try to release checker: table: 0x

Reply via email to