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

monkeydluffy 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 3a48d1788 fix(ci): stability of consul test cases (#10857)
3a48d1788 is described below

commit 3a48d17889cf1283e63a6e2b44ed33ab07dc4588
Author: AlinsRan <[email protected]>
AuthorDate: Tue Jan 23 09:15:53 2024 +0800

    fix(ci): stability of consul test cases (#10857)
---
 t/discovery/consul_dump.t | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/t/discovery/consul_dump.t b/t/discovery/consul_dump.t
index 42c8f7eb2..c58b80bbe 100644
--- a/t/discovery/consul_dump.t
+++ b/t/discovery/consul_dump.t
@@ -492,14 +492,19 @@ discovery:
         content_by_lua_block {
             local json = require("toolkit.json")
             local t = require("lib.test_admin")
-            ngx.sleep(2)
-            local code, body, res = 
t.test('/v1/discovery/consul/show_dump_file',
-                ngx.HTTP_GET)
-            local entity = json.decode(res)
-            ngx.say(json.encode(entity.services))
+            for i = 1, 3 do
+                ngx.sleep(2)
+                local code, body, res = 
t.test('/v1/discovery/consul/show_dump_file',
+                    ngx.HTTP_GET)
+                local entity = json.decode(res)
+                if entity.services and entity.services.service_a then
+                    ngx.say(json.encode(entity.services))
+                    return
+                end
+            end
         }
     }
---- timeout: 3
+--- timeout: 8
 --- request
 GET /t
 --- response_body

Reply via email to