aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec/generic/client_stub_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'src/ruby/spec/generic/client_stub_spec.rb')
-rw-r--r--src/ruby/spec/generic/client_stub_spec.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index c2543dc388..42cff4041b 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -477,10 +477,31 @@ describe 'ClientStub' do
/Header values must be of type string or array/)
end
+ def run_server_streamer_against_client_with_unmarshal_error(
+ expected_input, replys)
+ wakey_thread do |notifier|
+ c = expect_server_to_be_invoked(notifier)
+ expect(c.remote_read).to eq(expected_input)
+ begin
+ replys.each { |r| c.remote_send(r) }
+ rescue GRPC::Core::CallError
+ # An attempt to write to the client might fail. This is ok
+ # because the client call is expected to fail when
+ # unmarshalling the first response, and to cancel the call,
+ # and there is a race as for when the server-side call will
+ # start to fail.
+ p 'remote_send failed (allowed because call expected to cancel)'
+ ensure
+ c.send_status(OK, 'OK', true)
+ end
+ end
+ end
+
it 'the call terminates when there is an unmarshalling error' do
server_port = create_test_server
host = "localhost:#{server_port}"
- th = run_server_streamer(@sent_msg, @replys, @pass)
+ th = run_server_streamer_against_client_with_unmarshal_error(
+ @sent_msg, @replys)
stub = GRPC::ClientStub.new(host, :this_channel_is_insecure)
unmarshal = proc { fail(ArgumentError, 'test unmarshalling error') }