aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/bin/interop
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-08-13 21:45:04 -0700
committerGravatar Tim Emiola <temiola@google.com>2015-08-14 06:36:38 -0700
commitcdb7cccceb85a00e5518f7db916cbae24e24eea2 (patch)
tree1f440476367b74f059f6a23f21dd0c7611522b63 /src/ruby/bin/interop
parent49b7650eaf7c7991a64be0f3b4d9489b13c6353d (diff)
Adds the ruby timeout interop test.
Corrects some other issues - fixes status return when calls fail by always returning the status - resolves bidi_call client's failure to return an exception on bad status by swapping the wait for status to the read thread * this also improves the cancel_after_first_response test Also - adds a unit test that verifies that a bidi call will time out.
Diffstat (limited to 'src/ruby/bin/interop')
-rwxr-xr-xsrc/ruby/bin/interop/interop_client.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb
index da4caa842b..9d753a85ab 100755
--- a/src/ruby/bin/interop/interop_client.rb
+++ b/src/ruby/bin/interop/interop_client.rb
@@ -265,6 +265,17 @@ class NamedTests
p 'OK: ping_pong'
end
+ def timeout_on_sleeping_server
+ msg_sizes = [[27_182, 31_415]]
+ ppp = PingPongPlayer.new(msg_sizes)
+ resps = @stub.full_duplex_call(ppp.each_item, timeout: 0.001)
+ resps.each { |r| ppp.queue.push(r) }
+ fail 'Should have raised GRPC::BadStatus(DEADLINE_EXCEEDED)'
+ rescue GRPC::BadStatus => e
+ assert_equal(e.code, GRPC::Core::StatusCodes::DEADLINE_EXCEEDED)
+ p "OK: #{__callee__}"
+ end
+
def cancel_after_begin
msg_sizes = [27_182, 8, 1828, 45_904]
reqs = msg_sizes.map do |x|
@@ -283,7 +294,7 @@ class NamedTests
ppp = PingPongPlayer.new(msg_sizes)
op = @stub.full_duplex_call(ppp.each_item, return_op: true)
ppp.canceller_op = op # causes ppp to cancel after the 1st message
- op.execute.each { |r| ppp.queue.push(r) }
+ assert_raises(GRPC::Cancelled) { op.execute.each { |r| ppp.queue.push(r) } }
op.wait
assert(op.cancelled, 'call operation was not CANCELLED')
p 'OK: cancel_after_first_response'