Skip to content

Commit

Permalink
test_ack_handler: use singleton method instead of stub for stability (f…
Browse files Browse the repository at this point in the history
…luent#4698)

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 <[email protected]>
  • Loading branch information
Watson1978 authored Nov 6, 2024
1 parent af7d6d8 commit 7008d53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/plugin/out_forward/test_ack_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down

0 comments on commit 7008d53

Please sign in to comment.