mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/drb: Wrap tests definitions by DRbTests module. This makes
several tests (ACLEntryTest, TestBug4409, etc.) easier to understand that they are tests for DRb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
09ab3a0a9f
commit
5cd71131b8
15 changed files with 73 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Jun 1 12:05:10 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/drb: Wrap tests definitions by DRbTests module. This makes
|
||||
several tests (ACLEntryTest, TestBug4409, etc.) easier to understand
|
||||
that they are tests for DRb.
|
||||
|
||||
Sun Jun 1 11:36:25 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on
|
||||
|
|
|
@ -5,6 +5,8 @@ require 'timeout'
|
|||
require 'shellwords'
|
||||
require_relative '../ruby/envutil'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class DRbService
|
||||
@@manager = DRb::ExtServManager.new
|
||||
@@ruby = Shellwords.escape(EnvUtil.rubybin)
|
||||
|
@ -138,11 +140,11 @@ module DRbCore
|
|||
def test_02_unknown
|
||||
obj = @there.unknown_class
|
||||
assert_kind_of(DRb::DRbUnknown, obj)
|
||||
assert_equal('Unknown2', obj.name)
|
||||
assert_equal('DRbTests::Unknown2', obj.name)
|
||||
|
||||
obj = @there.unknown_module
|
||||
assert_kind_of(DRb::DRbUnknown, obj)
|
||||
assert_equal('DRbEx::', obj.name)
|
||||
assert_equal('DRbTests::DRbEx::', obj.name)
|
||||
|
||||
assert_raise(DRb::DRbUnknownError) do
|
||||
@there.unknown_error
|
||||
|
@ -364,3 +366,5 @@ module DRbAry
|
|||
EOS
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
require 'drbtest'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class TestDRbReusePort < Test::Unit::TestCase
|
||||
include DRbAry
|
||||
|
||||
|
@ -8,3 +10,4 @@ class TestDRbReusePort < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
require 'test/unit'
|
||||
require 'drb/acl'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class SampleHosts
|
||||
def initialize
|
||||
list = %w(127.0.0.1 localhost
|
||||
|
@ -192,4 +194,4 @@ class ACLTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
require_relative 'drbtest'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class TestDRbCore < Test::Unit::TestCase
|
||||
include DRbCore
|
||||
|
||||
|
@ -320,3 +322,5 @@ class TestBug4409 < Test::Unit::TestCase
|
|||
assert(@there.foo?(foo))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ begin
|
|||
rescue LoadError
|
||||
end
|
||||
|
||||
module DRbTests
|
||||
|
||||
if Object.const_defined?("OpenSSL")
|
||||
|
||||
|
||||
|
@ -59,4 +61,6 @@ class TestDRbSSLAry < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ begin
|
|||
rescue LoadError
|
||||
end
|
||||
|
||||
module DRbTests
|
||||
|
||||
if Object.const_defined?("UNIXServer")
|
||||
|
||||
|
||||
|
@ -43,4 +45,6 @@ class TestDRbUNIXAry < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -9,6 +9,8 @@ if __FILE__ == $0
|
|||
it
|
||||
end
|
||||
|
||||
module DRbTests
|
||||
|
||||
TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
|
||||
|
@ -19,8 +21,10 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|||
|
||||
TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
|
||||
|
||||
end
|
||||
|
||||
config = Hash.new
|
||||
config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
|
||||
config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
|
||||
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
|
||||
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
|
||||
true
|
||||
|
|
|
@ -2,6 +2,8 @@ require 'drb/drb'
|
|||
require 'drb/extserv'
|
||||
require 'timeout'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class XArray < Array
|
||||
def initialize(ary)
|
||||
ary.each do |x|
|
||||
|
@ -147,6 +149,8 @@ class DRbEx
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
def ARGV.shift
|
||||
it = super()
|
||||
|
@ -156,7 +160,7 @@ if __FILE__ == $0
|
|||
|
||||
DRb::DRbServer.default_argc_limit(8)
|
||||
DRb::DRbServer.default_load_limit(4096)
|
||||
DRb.start_service('druby://localhost:0', DRbEx.new)
|
||||
DRb.start_service('druby://localhost:0', DRbTests::DRbEx.new)
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
|
|
|
@ -8,6 +8,8 @@ if __FILE__ == $0
|
|||
it
|
||||
end
|
||||
|
||||
module DRbTests
|
||||
|
||||
TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
|
||||
|
@ -18,8 +20,10 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|||
|
||||
TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
|
||||
|
||||
end
|
||||
|
||||
config = Hash.new
|
||||
config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
|
||||
config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
|
||||
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
|
||||
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
|
||||
true
|
||||
|
@ -29,7 +33,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|||
|
||||
DRb::DRbServer.default_argc_limit(8)
|
||||
DRb::DRbServer.default_load_limit(4096)
|
||||
DRb.start_service('drbssl://localhost:0', DRbEx.new, config)
|
||||
DRb.start_service('drbssl://localhost:0', DRbTests::DRbEx.new, config)
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
|
|
|
@ -9,7 +9,7 @@ if __FILE__ == $0
|
|||
|
||||
DRb::DRbServer.default_argc_limit(8)
|
||||
DRb::DRbServer.default_load_limit(4096)
|
||||
DRb.start_service('drbunix:', DRbEx.new)
|
||||
DRb.start_service('drbunix:', DRbTests::DRbEx.new)
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'drb/drb'
|
||||
require 'drb/extserv'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class Foo
|
||||
include DRbUndumped
|
||||
end
|
||||
|
@ -17,6 +19,8 @@ class Bar
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
def ARGV.shift
|
||||
it = super()
|
||||
|
@ -24,8 +28,9 @@ if __FILE__ == $0
|
|||
it
|
||||
end
|
||||
|
||||
DRb.start_service('druby://localhost:0', Bar.new)
|
||||
DRb.start_service('druby://localhost:0', DRbTests::Bar.new)
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'drb/drb'
|
||||
require 'drb/extserv'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class EvalAttack
|
||||
def initialize
|
||||
@four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4})
|
||||
|
@ -15,6 +17,8 @@ class EvalAttack
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
if __FILE__ == $0
|
||||
def ARGV.shift
|
||||
|
@ -25,7 +29,7 @@ if __FILE__ == $0
|
|||
|
||||
$SAFE = 1
|
||||
|
||||
DRb.start_service('druby://localhost:0', EvalAttack.new, {:safe_level => 2})
|
||||
DRb.start_service('druby://localhost:0', DRbTests::EvalAttack.new, {:safe_level => 2})
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
|
|
|
@ -2,6 +2,8 @@ require 'drb/drb'
|
|||
require 'drb/extserv'
|
||||
require 'timeout'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class DRbLarge
|
||||
include DRbUndumped
|
||||
|
||||
|
@ -22,6 +24,8 @@ class DRbLarge
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
def ARGV.shift
|
||||
it = super()
|
||||
|
@ -31,7 +35,7 @@ if __FILE__ == $0
|
|||
|
||||
DRb::DRbServer.default_argc_limit(3)
|
||||
DRb::DRbServer.default_load_limit(100000)
|
||||
DRb.start_service('druby://localhost:0', DRbLarge.new)
|
||||
DRb.start_service('druby://localhost:0', DRbTests::DRbLarge.new)
|
||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
||||
DRb.thread.join
|
||||
es.stop_service if es.alive?
|
||||
|
|
|
@ -2,6 +2,8 @@ require 'runit/testcase'
|
|||
require 'runit/cui/testrunner'
|
||||
require 'timerholder'
|
||||
|
||||
module DRbTests
|
||||
|
||||
class TimerHolderTest < RUNIT::TestCase
|
||||
def do_test(timeout, keeper_sleep = nil)
|
||||
holder = TimerHolder.new(timeout)
|
||||
|
@ -44,6 +46,8 @@ class TimerHolderTest < RUNIT::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
RUNIT::CUI::TestRunner.run(TimerHolderTest.suite)
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
RUNIT::CUI::TestRunner.run(DRbTests::TimerHolderTest.suite)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue