summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-16 15:10:17 +0000
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-16 15:10:17 +0000
commitef46698d765a52c64c38a28d5229fd89e92b2e8d (patch)
tree49a7f63285fdc791a2bbbd4f8885322100dfb01a /test
parent880f2d7dea5fc243702fd9badac5ed469d9a99e2 (diff)
remove TestDRbReusePort, resuce sleep, add DRbService.ext_service
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/drb/drbtest.rb13
-rw-r--r--test/drb/test_drb.rb26
-rw-r--r--test/drb/test_drbssl.rb16
-rw-r--r--test/drb/test_drbunix.rb15
-rw-r--r--test/drb/ut_drb.rb2
5 files changed, 23 insertions, 49 deletions
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index 7f2c46d..b0ba762 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -26,6 +26,11 @@ class DRbService
def self.server
@server || @@server
end
+ def self.ext_service(name)
+ timeout(10, RuntimeError) do
+ manager.service(name)
+ end
+ end
end
class Onecky
@@ -61,12 +66,12 @@ end
module DRbCore
def setup
- @ext = DRbService.manager.service('ut_drb.rb')
+ @ext = DRbService.ext_service('ut_drb.rb')
@there = @ext.front
end
def teardown
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_00_DRbObject
@@ -244,12 +249,12 @@ end
module DRbAry
def setup
- @ext = DRbService.manager.service('ut_array.rb')
+ @ext = DRbService.ext_service('ut_array.rb')
@there = @ext.front
end
def teardown
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_01
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index 16d4731..468c970 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -6,12 +6,12 @@ end
class TestDRbYield < Test::Unit::TestCase
def setup
- @ext = DRbService.manager.service('ut_drb.rb')
+ @ext = DRbService.ext_service('ut_drb.rb')
@there = @ext.front
end
def teardown
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_01_one
@@ -172,7 +172,7 @@ end
class TestDRbMServer < Test::Unit::TestCase
def setup
- @ext = DRbService.manager.service('ut_drb.rb')
+ @ext = DRbService.ext_service('ut_drb.rb')
@there = @ext.front
@server = (1..3).collect do |n|
DRb::DRbServer.new(nil, Onecky.new(n.to_s))
@@ -183,7 +183,7 @@ class TestDRbMServer < Test::Unit::TestCase
@server.each do |s|
s.stop_service
end
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_01
@@ -191,17 +191,9 @@ class TestDRbMServer < Test::Unit::TestCase
end
end
-class TestDRbReusePort < TestDRbAry
- def setup
- sleep 1.2
- @ext = DRbService.manager.service('ut_port.rb')
- @there = @ext.front
- end
-end
-
class TestDRbSafe1 < TestDRbAry
def setup
- @ext = DRbService.manager.service('ut_safe1.rb')
+ @ext = DRbService.ext_service('ut_safe1.rb')
@there = @ext.front
end
end
@@ -209,12 +201,12 @@ end
class TestDRbEval < Test::Unit::TestCase
def setup
super
- @ext = DRbService.manager.service('ut_eval.rb')
+ @ext = DRbService.ext_service('ut_eval.rb')
@there = @ext.front
end
def teardown
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_01_safe1_safe4_eval
@@ -257,12 +249,12 @@ end
class TestDRbLarge < Test::Unit::TestCase
def setup
- @ext = DRbService.manager.service('ut_large.rb')
+ @ext = DRbService.ext_service('ut_large.rb')
@there = @ext.front
end
def teardown
- @ext.stop_service
+ @ext.stop_service if @ext
end
def test_01_large_ary
diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index b5dd68f..b68eb12 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -36,7 +36,7 @@ end
class TestDRbSSLCore < Test::Unit::TestCase
include DRbCore
def setup
- @ext = DRbSSLService.manager.service('ut_drb_drbssl.rb')
+ @ext = DRbSSLService.ext_service('ut_drb_drbssl.rb')
@there = @ext.front
end
@@ -48,24 +48,12 @@ class TestDRbSSLCore < Test::Unit::TestCase
def test_05_eq
end
-
- def test_06_timeout
- ten = Onecky.new(3)
- assert_raises(TimeoutError) do
- @there.do_timeout(ten)
- end
- assert_raises(TimeoutError) do
- @there.do_timeout(ten)
- end
- sleep 3
- end
-
end
class TestDRbSSLAry < Test::Unit::TestCase
include DRbAry
def setup
- @ext = DRbSSLService.manager.service('ut_array_drbssl.rb')
+ @ext = DRbSSLService.ext_service('ut_array_drbssl.rb')
@there = @ext.front
end
end
diff --git a/test/drb/test_drbunix.rb b/test/drb/test_drbunix.rb
index e35a7bd..79747ae 100644
--- a/test/drb/test_drbunix.rb
+++ b/test/drb/test_drbunix.rb
@@ -20,7 +20,7 @@ end
class TestDRbUNIXCore < Test::Unit::TestCase
include DRbCore
def setup
- @ext = DRbUNIXService.manager.service('ut_drb_drbunix.rb')
+ @ext = DRbUNIXService.ext_service('ut_drb_drbunix.rb')
@there = @ext.front
end
@@ -32,23 +32,12 @@ class TestDRbUNIXCore < Test::Unit::TestCase
def test_05_eq
end
-
- def test_06_timeout
- ten = Onecky.new(3)
- assert_raises(TimeoutError) do
- @there.do_timeout(ten)
- end
- assert_raises(TimeoutError) do
- @there.do_timeout(ten)
- end
- sleep 3
- end
end
class TestDRbUNIXAry < Test::Unit::TestCase
include DRbAry
def setup
- @ext = DRbUNIXService.manager.service('ut_array_drbunix.rb')
+ @ext = DRbUNIXService.ext_service('ut_array_drbunix.rb')
@there = @ext.front
end
end
diff --git a/test/drb/ut_drb.rb b/test/drb/ut_drb.rb
index b0d3a5b..93ac1d8 100644
--- a/test/drb/ut_drb.rb
+++ b/test/drb/ut_drb.rb
@@ -49,7 +49,7 @@ class DRbEx
end
def do_timeout(n)
- timeout(1) do
+ timeout(0.1) do
n.sleep(2)
end
end