diff --git a/spec/02-integration/18-hybrid_rpc/06-batch-rpc_spec.lua b/spec/02-integration/18-hybrid_rpc/06-batch-rpc_spec.lua index f60e20972679..636984386b00 100644 --- a/spec/02-integration/18-hybrid_rpc/06-batch-rpc_spec.lua +++ b/spec/02-integration/18-hybrid_rpc/06-batch-rpc_spec.lua @@ -44,34 +44,33 @@ for _, strategy in helpers.each_strategy() do local cp_logfile = nil local dp_logfile = "servroot2/logs/error.log" - helpers.pwait_until(function() - assert.logfile(dp_logfile).has.line( - "[rpc] sent batch RPC call: 1", true) + assert.logfile(dp_logfile).has.line( + "[rpc] sent batch RPC call: 1", true, 10) - assert.logfile(cp_logfile).has.line( - "[rpc] got batch RPC call: 1", true) - assert.logfile(cp_logfile).has.line( - "kong.test.batch called: world", true) + assert.logfile(cp_logfile).has.line( + "[rpc] got batch RPC call: 1", true, 10) + assert.logfile(cp_logfile).has.line( + "kong.test.batch called: world", true, 10) - assert.logfile(dp_logfile).has.line( - "[rpc] got batch RPC call: 1", true) - assert.logfile(dp_logfile).has.line( - "kong.test.batch called: hello world", true) + assert.logfile(dp_logfile).has.line( + "[rpc] got batch RPC call: 1", true, 10) + assert.logfile(dp_logfile).has.line( + "kong.test.batch called: hello world", true, 10) - assert.logfile(dp_logfile).has.line( - "[rpc] sent batch RPC call: 2", true) + assert.logfile(dp_logfile).has.line( + "[rpc] sent batch RPC call: 2", true, 10) - assert.logfile(cp_logfile).has.line( - "[rpc] got batch RPC call: 2", true) - assert.logfile(cp_logfile).has.line( - "kong.test.batch called: kong", true) - assert.logfile(cp_logfile).has.line( - "kong.test.batch called: gateway", true) - assert.logfile(cp_logfile).has.line( - "[rpc] notification has no response", true) + assert.logfile(cp_logfile).has.line( + "[rpc] got batch RPC call: 2", true, 10) + assert.logfile(cp_logfile).has.line( + "kong.test.batch called: kong", true, 10) + assert.logfile(cp_logfile).has.line( + "kong.test.batch called: gateway", true, 10) + assert.logfile(cp_logfile).has.line( + "[rpc] notification has no response", true, 10) - return true - end, 15) + assert.logfile(dp_logfile).has.line( + "kong.test.batch ok", true, 10) end) end) end) diff --git a/spec/fixtures/custom_plugins/kong/plugins/rpc-batch-test/handler.lua b/spec/fixtures/custom_plugins/kong/plugins/rpc-batch-test/handler.lua index 92cb24226a77..2bb3a0b57612 100644 --- a/spec/fixtures/custom_plugins/kong/plugins/rpc-batch-test/handler.lua +++ b/spec/fixtures/custom_plugins/kong/plugins/rpc-batch-test/handler.lua @@ -16,17 +16,15 @@ function RpcBatchTestHandler:init_worker() worker_events.register(function(capabilities_list) kong.rpc:__set_batch(1) - local res = kong.rpc:call("control_plane", "kong.test.batch", "world") - if not res then - return - end + local res = assert(kong.rpc:call("control_plane", "kong.test.batch", "world")) ngx.log(ngx.DEBUG, "kong.test.batch called: ", res) kong.rpc:__set_batch(2) - kong.rpc:notify("control_plane", "kong.test.batch", "kong") - kong.rpc:notify("control_plane", "kong.test.batch", "gateway") + assert(kong.rpc:notify("control_plane", "kong.test.batch", "kong")) + assert(kong.rpc:notify("control_plane", "kong.test.batch", "gateway")) + ngx.log(ngx.DEBUG, "kong.test.batch ok") end, "clustering:jsonrpc", "connected") end