From 49830455fd91c0d2f7ca5d251494bb4fac001a5e Mon Sep 17 00:00:00 2001 From: Antoine Jacquemin Date: Fri, 26 Apr 2024 17:00:05 +0200 Subject: [PATCH] remove sleep from test file --- .../02-integration/22-ai_plugins/01-reports_spec.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/02-integration/22-ai_plugins/01-reports_spec.lua b/spec/02-integration/22-ai_plugins/01-reports_spec.lua index c07ac5a5ceb7..78c98c03153f 100644 --- a/spec/02-integration/22-ai_plugins/01-reports_spec.lua +++ b/spec/02-integration/22-ai_plugins/01-reports_spec.lua @@ -13,11 +13,13 @@ for _, strategy in helpers.each_strategy() do describe("anonymous reports for ai plugins #" .. strategy, function() local reports_send_ping = function(port) - ngx.sleep(0.2) -- hand over the CPU so other threads can do work (processing the sent data) - admin_client = helpers.admin_client() - local res = admin_client:post("/reports/send-ping" .. (port and "?port=" .. port or "")) - assert.response(res).has_status(200) - admin_client:close() + assert.eventually(function() + admin_client = helpers.admin_client() + local res = admin_client:post("/reports/send-ping" .. (port and "?port=" .. port or "")) + assert.response(res).has_status(200) + admin_client:close() + end) + .has_no_error("ping request was sent successfully") end lazy_setup(function()