|
|
|
@ -451,10 +451,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') } |
|
|
|
|