summaryrefslogtreecommitdiff
path: root/test/drb/test_drbssl.rb
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 13:14:02 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 13:14:02 +0000
commit4757c7eead9ef8aa999fb2a8b7f68dc14701914f (patch)
treed3172688771609853d949fa54f33bc54a59517f8 /test/drb/test_drbssl.rb
parenteab51f71d608ae38c42be7962acbb426ceac5f7d (diff)
Run background threads while testing drb
Do not start background thread on load test/drb/drbtest.rb, and stop threads on each test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/drb/test_drbssl.rb')
-rw-r--r--test/drb/test_drbssl.rb54
1 files changed, 24 insertions, 30 deletions
diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index 1f1495356e0..8ab010e1c41 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -15,37 +15,35 @@ class DRbSSLService < DRbService
%w(ut_drb_drbssl.rb ut_array_drbssl.rb).each do |nm|
add_service_command(nm)
end
- config = Hash.new
-
- config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
- config[:SSLVerifyCallback] = lambda{ |ok,x509_store|
- true
- }
- begin
- data = open("sample.key"){|io| io.read }
- config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data)
- data = open("sample.crt"){|io| io.read }
- config[:SSLCertificate] = OpenSSL::X509::Certificate.new(data)
- rescue
- # $stderr.puts "Switching to use self-signed certificate"
- config[:SSLCertName] =
- [ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
- end
- uri = ARGV.shift if $0 == __FILE__
- @server = DRb::DRbServer.new(uri || 'drbssl://:0', self.manager, config)
+ def start
+ config = Hash.new
+
+ config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
+ config[:SSLVerifyCallback] = lambda{ |ok,x509_store|
+ true
+ }
+ begin
+ data = open("sample.key"){|io| io.read }
+ config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data)
+ data = open("sample.crt"){|io| io.read }
+ config[:SSLCertificate] = OpenSSL::X509::Certificate.new(data)
+ rescue
+ # $stderr.puts "Switching to use self-signed certificate"
+ config[:SSLCertName] =
+ [ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
+ end
+
+ @server = DRb::DRbServer.new('drbssl://:0', manager, config)
+ end
end
class TestDRbSSLCore < Test::Unit::TestCase
include DRbCore
def setup
- setup_service 'ut_drb_drbssl.rb'
- super
- end
-
- def teardown
+ @drb_service = DRbSSLService.new
super
- DRbService.finish
+ setup_service 'ut_drb_drbssl.rb'
end
def test_02_unknown
@@ -61,13 +59,9 @@ end
class TestDRbSSLAry < Test::Unit::TestCase
include DRbAry
def setup
- setup_service 'ut_array_drbssl.rb'
- super
- end
-
- def teardown
+ @drb_service = DRbSSLService.new
super
- DRbService.finish
+ setup_service 'ut_array_drbssl.rb'
end
end