Skip to content

Commit fbbc37d

Browse files
committed
test/drb/test_drb.rb: Specify the host of DRbServer
to try fixing the following error. http://rubyci.s3.amazonaws.com/opensuseleap/ruby-master/log/20210407T063004Z.log.html.gz ``` [ 605/21105] DRbTests::TestDRbSSLAry#test_06_next/home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/lib/drb/drb.rb:1138:in `method_missing': undefined method `regist' for [1, 2, "III", 4, "five", 6]:Array (NoMethodError) from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/lib/drb/extserv.rb:21:in `block in initialize' from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/.ext/common/monitor.rb:202:in `synchronize' from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/.ext/common/monitor.rb:202:in `mon_synchronize' from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/lib/drb/extserv.rb:20:in `initialize' from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/test/drb/ut_array_drbssl.rb:35:in `new' from /home/chkbuild/chkbuild/tmp/build/20210407T063004Z/ruby/test/drb/ut_array_drbssl.rb:35:in `<main>' = 100.05 s ``` Here is my analysis: The test of drb used both `druby://:0` and `druby://localhost:0` for DRbServer. However, the former listens on IPv4, and the latter does on IPv6, depending on environments. The port 0 is automatically assigned, but sometimes the same port is used to both because they are different protocols (IPv4 and IPv6). In this case, their URIs are resolved to the completely same one (`druby://localhost:port`), which confuses the method `DRb.here?` which determines the DRbObject is remote or local. This changeset uses `druby://localhost:0` consistently.
1 parent 31ba817 commit fbbc37d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

test/drb/test_drb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class BO < BasicObject
323323
end
324324

325325
def test_any_to_s
326-
server = DRb::DRbServer.new('druby://:0')
326+
server = DRb::DRbServer.new('druby://localhost:0')
327327
server.singleton_class.send(:public, :any_to_s)
328328
assert_equal("foo:String", server.any_to_s("foo"))
329329
assert_match(/\A#<DRbTests::TestDRbAnyToS::BO:0x[0-9a-f]+>\z/, server.any_to_s(BO.new))
@@ -335,7 +335,7 @@ def test_any_to_s
335335

336336
class TestDRbTCP < Test::Unit::TestCase
337337
def test_immediate_close
338-
server = DRb::DRbServer.new('druby://:0')
338+
server = DRb::DRbServer.new('druby://localhost:0')
339339
host, port, = DRb::DRbTCPSocket.send(:parse_uri, server.uri)
340340
socket = TCPSocket.open host, port
341341
socket.shutdown

test/drb/test_drbssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def start
3434
[ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
3535
end
3636

37-
@server = DRb::DRbServer.new('drbssl://:0', manager, config)
37+
@server = DRb::DRbServer.new('drbssl://localhost:0', manager, config)
3838
end
3939
end
4040

0 commit comments

Comments
 (0)