summaryrefslogtreecommitdiff
path: root/ruby/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-05-26 12:28:36 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-05-26 12:28:36 +0200
commit9247e49f5bb67b0cad705b1ffd607e6202224bef (patch)
tree3621088fcd8dcb77233c7d66867b3ee915829b0d /ruby/test
parentFixed ICE-7922 - Review retry/network tracing (diff)
downloadice-9247e49f5bb67b0cad705b1ffd607e6202224bef.tar.bz2
ice-9247e49f5bb67b0cad705b1ffd607e6202224bef.tar.xz
ice-9247e49f5bb67b0cad705b1ffd607e6202224bef.zip
Improved timeout test to better deal with slow VMs
Diffstat (limited to 'ruby/test')
-rw-r--r--ruby/test/Ice/timeout/AllTests.rb40
1 files changed, 18 insertions, 22 deletions
diff --git a/ruby/test/Ice/timeout/AllTests.rb b/ruby/test/Ice/timeout/AllTests.rb
index 4b62a9b1712..746191bf588 100644
--- a/ruby/test/Ice/timeout/AllTests.rb
+++ b/ruby/test/Ice/timeout/AllTests.rb
@@ -7,6 +7,20 @@
#
# **********************************************************************
+def connect(prx)
+ nRetry = 5
+ while nRetry > 0 do
+ nRetry -=1
+ begin
+ prx.ice_getConnection() # Establish connection.
+ break
+ rescue Ice::ConnectTimeoutException
+ # Can sporadically occur with slow machines
+ end
+ end
+ return prx.ice_getConnection()
+end
+
def allTests(communicator)
sref = "timeout:default -p 12010"
obj = communicator.stringToProxy(sref)
@@ -96,17 +110,7 @@ def allTests(communicator)
print "testing close timeout... "
STDOUT.flush
to = Test::TimeoutPrx.checkedCast(obj.ice_timeout(250))
- nRetry = 5
- while nRetry > 0 do
- nRetry -=1
- begin
- to.ice_getConnection() # Establish connection.
- break
- rescue Ice::ConnectTimeoutException
- # Can sporadically occur with slow machines
- end
- end
- connection = to.ice_getConnection()
+ connection = connect(to);
timeout.holdAdapter(600)
connection.close(Ice::ConnectionClose::GracefullyWithWait)
begin
@@ -136,6 +140,7 @@ def allTests(communicator)
initData.properties.setProperty("Ice.Override.Timeout", "100")
comm = Ice.initialize(initData)
to = Test::TimeoutPrx::checkedCast(comm.stringToProxy(sref))
+ connect(to)
timeout.holdAdapter(500)
begin
to.sendData(seq)
@@ -148,6 +153,7 @@ def allTests(communicator)
#
timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::checkedCast(to.ice_timeout(1000))
+ connect(to)
timeout.holdAdapter(500)
begin
to.sendData(seq)
@@ -191,17 +197,7 @@ def allTests(communicator)
#
timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::uncheckedCast(to.ice_timeout(250))
- nRetry = 5
- while nRetry > 0 do
- nRetry -=1
- begin
- to.ice_getConnection() # Establish connection.
- break
- rescue Ice::ConnectTimeoutException
- # Can sporadically occur with slow machines
- end
- end
- to.ice_getConnection() # Establish connection.
+ connect(to)
timeout.holdAdapter(750)
begin
to.sendData(seq)