mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 19:14:00 +02:00
test/rinda/test_rinda.rb: Add more debugging code
in addition to de5e8d0e3b
This commit is contained in:
parent
0d17cdd0ac
commit
ac803ab55d
1 changed files with 25 additions and 0 deletions
|
@ -642,7 +642,32 @@ class TestRingServer < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_do_reply
|
||||
# temporaliry redefine Rinda::RingServer#do_reply for a debugging purpose
|
||||
Rinda::RingServer.class_eval do
|
||||
alias do_reply_back do_reply
|
||||
def do_reply
|
||||
tuple = @ts.take([:lookup_ring, nil], @renewer)
|
||||
Thread.new do
|
||||
begin
|
||||
tuple[1].call(@ts)
|
||||
rescue
|
||||
p :in_thread, $!, *$!.backtrace
|
||||
nil
|
||||
end
|
||||
end
|
||||
rescue
|
||||
p :out_of_thread, $!, *$!.backtrace
|
||||
end
|
||||
end
|
||||
|
||||
with_timeout(30) {_test_do_reply}
|
||||
|
||||
ensure
|
||||
Rinda::RingServer.class_eval do
|
||||
remove_method :do_reply
|
||||
alias do_reply do_reply_back
|
||||
remove_method :do_reply_back
|
||||
end
|
||||
end
|
||||
|
||||
def _test_do_reply
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue