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 9e2e5c8  test: make admin/plugins-reload.t stable (#3192)
9e2e5c8 is described below

commit 9e2e5c8a63d26d69323198b016f06c47cf994199
Author: 罗泽轩 <spacewander...@gmail.com>
AuthorDate: Mon Jan 11 01:49:11 2021 -0600

    test: make admin/plugins-reload.t stable (#3192)
---
 t/admin/plugins-reload.t | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/admin/plugins-reload.t b/t/admin/plugins-reload.t
index c84c955..61ae4e2 100644
--- a/t/admin/plugins-reload.t
+++ b/t/admin/plugins-reload.t
@@ -73,13 +73,15 @@ location /t {
         local config_util   = require("apisix.core.config_util")
         ngx.sleep(0.1) -- make sure the sync happened when admin starts is 
already finished
 
+        local before_reload = true
         local plugins_conf, err
         plugins_conf, err = core.config.new("/plugins", {
             automatic = true,
             single_item = true,
             filter = function()
                 -- called twice, one for readir, another for waitdir
-                ngx.log(ngx.WARN, "reload plugins on node ")
+                ngx.log(ngx.WARN, "reload plugins on node ",
+                        before_reload and "before reload" or "after reload")
                 local plugins = {}
                 for _, conf_value in 
config_util.iterate_values(plugins_conf.values) do
                     core.table.insert_tail(plugins, unpack(conf_value.value))
@@ -91,6 +93,7 @@ location /t {
             error("failed to create etcd instance for fetching /plugins : "
                 .. err)
         end
+        ngx.sleep(0.5)
 
         local data = [[
 apisix:
@@ -103,6 +106,7 @@ stream_plugins:
         ]]
         require("lib.test_admin").set_config_yaml(data)
 
+        before_reload = false
         local t = require("lib.test_admin").test
         local code, _, org_body = t('/apisix/admin/plugins/reload',
                                     ngx.HTTP_PUT)
@@ -117,10 +121,10 @@ GET /t
 --- response_body
 done
 --- grep_error_log eval
-qr/reload plugins on node/
+qr/reload plugins on node \w+ reload/
 --- grep_error_log_out
-reload plugins on node
-reload plugins on node
+reload plugins on node before reload
+reload plugins on node after reload
 --- error_log
 filter(): [{"name":"jwt-auth"},{"name":"mqtt-proxy","stream":true}]
 

Reply via email to