diff --git a/t/with_resty-events/03-get_target_status.t b/t/with_resty-events/03-get_target_status.t index fd196231..455654c5 100644 --- a/t/with_resty-events/03-get_target_status.t +++ b/t/with_resty-events/03-get_target_status.t @@ -12,6 +12,14 @@ our $HttpConfig = qq{ lua_package_path "$pwd/lib/?.lua;;"; lua_shared_dict test_shm 8m; + init_worker_by_lua_block { + local we = require "resty.events.compat" + assert(we.configure({ + listening = "unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock" + })) + assert(we.configured()) + } + server { server_name kong_worker_events; listen unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock; @@ -43,8 +51,6 @@ qq{ --- config location = /t { content_by_lua_block { - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing", diff --git a/t/with_resty-events/03-get_target_status_with_sleeps.t b/t/with_resty-events/03-get_target_status_with_sleeps.t index 17feeb45..6dc9d776 100644 --- a/t/with_resty-events/03-get_target_status_with_sleeps.t +++ b/t/with_resty-events/03-get_target_status_with_sleeps.t @@ -12,6 +12,16 @@ our $HttpConfig = qq{ lua_package_path "$pwd/lib/?.lua;;"; lua_shared_dict test_shm 8m; + init_worker_by_lua_block { + local we = require "resty.events.compat" + assert(we.configure({ + unique_timeout = 5, + broker_id = 0, + listening = "unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock" + })) + assert(we.configured()) + } + server { server_name kong_worker_events; listen unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock; @@ -43,10 +53,6 @@ qq{ --- config location = /t { content_by_lua_block { - ngx.sleep(0.1) - - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing", diff --git a/t/with_resty-events/04-report_success.t b/t/with_resty-events/04-report_success.t index ba9ca08a..020f0190 100644 --- a/t/with_resty-events/04-report_success.t +++ b/t/with_resty-events/04-report_success.t @@ -12,6 +12,14 @@ our $HttpConfig = qq{ lua_package_path "$pwd/lib/?.lua;;"; lua_shared_dict test_shm 8m; + init_worker_by_lua_block { + local we = require "resty.events.compat" + assert(we.configure({ + listening = "unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock" + })) + assert(we.configured()) + } + server { server_name kong_worker_events; listen unix:$ENV{TEST_NGINX_SERVROOT}/worker_events.sock; @@ -45,8 +53,6 @@ qq{ --- config location = /t { content_by_lua_block { - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing", @@ -121,8 +127,6 @@ qq{ --- config location = /t { content_by_lua_block { - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing", @@ -196,8 +200,6 @@ qq{ --- config location = /t { content_by_lua_block { - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing", @@ -261,8 +263,6 @@ qq{ --- config location = /t { content_by_lua_block { - local we = require "resty.events.compat" - assert(we.configure({ unique_timeout = 5, broker_id = 0, listening = "unix:" .. ngx.config.prefix() .. "worker_events.sock" })) local healthcheck = require("resty.healthcheck") local checker = healthcheck.new({ name = "testing",