From 0f2faf18eea53d945d4b6ad961b47b30ed48f84f Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 6 Nov 2024 12:27:45 +0900 Subject: [PATCH] test_ack_handler: use singleton method instead of stub for stability When using stub, sometimes it causes errors when it remove prepared methods by stub. To improve the stability of the CI, this patch will use the singleton method instead of stub. Signed-off-by: Shizuo Fujita --- test/plugin/out_forward/test_ack_handler.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/plugin/out_forward/test_ack_handler.rb b/test/plugin/out_forward/test_ack_handler.rb index 8264e4ac99..9246da8622 100644 --- a/test/plugin/out_forward/test_ack_handler.rb +++ b/test/plugin/out_forward/test_ack_handler.rb @@ -111,11 +111,11 @@ class AckHandlerTest < Test::Unit::TestCase r, w = IO.pipe begin w.write(chunk_id) - stub(r).recv { |_| + def r.recv(arg) sleep(1) # To ensure that multiple threads select the socket before closing. - raise IOError, 'stream closed in another thread' if r.closed? + raise IOError, 'stream closed in another thread' if self.closed? MessagePack.pack({ 'ack' => Base64.encode64('chunk_id 111') }) - } + end ack.enqueue(r) threads = []