Merge pull request #1080 from tbetbetbe/grpc_ruby_add_back_server_finish_calls

Adds back calls to #finish at the end of server calls
pull/1089/merge
Michael Lumish 10 years ago
commit 0e93c92d06
  1. 1
      src/ruby/lib/grpc/generic/rpc_desc.rb
  2. 10
      src/ruby/spec/generic/client_stub_spec.rb
  3. 4
      src/ruby/spec/generic/rpc_desc_spec.rb

@ -81,6 +81,7 @@ module GRPC
active_call.run_server_bidi(mth) active_call.run_server_bidi(mth)
end end
send_status(active_call, OK, 'OK') send_status(active_call, OK, 'OK')
active_call.finished
rescue BadStatus => e rescue BadStatus => e
# this is raised by handlers that want GRPC to send an application # this is raised by handlers that want GRPC to send an application
# error code and detail message. # error code and detail message.

@ -434,7 +434,7 @@ describe 'ClientStub' do
end end
expect(c.remote_read).to eq(expected_input) expect(c.remote_read).to eq(expected_input)
replys.each { |r| c.remote_send(r) } replys.each { |r| c.remote_send(r) }
c.send_status(status, status == @pass ? 'OK' : 'NOK') c.send_status(status, status == @pass ? 'OK' : 'NOK', true)
end end
end end
@ -444,7 +444,7 @@ describe 'ClientStub' do
c = expect_server_to_be_invoked(mtx, cnd) c = expect_server_to_be_invoked(mtx, cnd)
expected_inputs.each { |i| expect(c.remote_read).to eq(i) } expected_inputs.each { |i| expect(c.remote_read).to eq(i) }
replys.each { |r| c.remote_send(r) } replys.each { |r| c.remote_send(r) }
c.send_status(status, status == @pass ? 'OK' : 'NOK') c.send_status(status, status == @pass ? 'OK' : 'NOK', true)
end end
end end
@ -460,7 +460,7 @@ describe 'ClientStub' do
expect(c.remote_read).to eq(i) expect(c.remote_read).to eq(i)
end end
end end
c.send_status(status, status == @pass ? 'OK' : 'NOK') c.send_status(status, status == @pass ? 'OK' : 'NOK', true)
end end
end end
@ -473,7 +473,7 @@ describe 'ClientStub' do
expect(c.metadata[k.to_s]).to eq(v) expect(c.metadata[k.to_s]).to eq(v)
end end
c.remote_send(resp) c.remote_send(resp)
c.send_status(status, status == @pass ? 'OK' : 'NOK') c.send_status(status, status == @pass ? 'OK' : 'NOK', true)
end end
end end
@ -486,7 +486,7 @@ describe 'ClientStub' do
expect(c.metadata[k.to_s]).to eq(v) expect(c.metadata[k.to_s]).to eq(v)
end end
c.remote_send(resp) c.remote_send(resp)
c.send_status(status, status == @pass ? 'OK' : 'NOK') c.send_status(status, status == @pass ? 'OK' : 'NOK', true)
end end
end end

@ -94,6 +94,7 @@ describe GRPC::RpcDesc do
expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_read).once.and_return(req)
expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:remote_send).once.with(@ok_response)
expect(@call).to receive(:send_status).once.with(OK, 'OK') expect(@call).to receive(:send_status).once.with(OK, 'OK')
expect(@call).to receive(:finished).once
@request_response.run_server_method(@call, method(:fake_reqresp)) @request_response.run_server_method(@call, method(:fake_reqresp))
end end
end end
@ -134,6 +135,7 @@ describe GRPC::RpcDesc do
it 'sends a response and closes the stream if there no errors' do it 'sends a response and closes the stream if there no errors' do
expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:remote_send).once.with(@ok_response)
expect(@call).to receive(:send_status).once.with(OK, 'OK') expect(@call).to receive(:send_status).once.with(OK, 'OK')
expect(@call).to receive(:finished).once
@client_streamer.run_server_method(@call, method(:fake_clstream)) @client_streamer.run_server_method(@call, method(:fake_clstream))
end end
end end
@ -178,6 +180,7 @@ describe GRPC::RpcDesc do
expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_read).once.and_return(req)
expect(@call).to receive(:remote_send).twice.with(@ok_response) expect(@call).to receive(:remote_send).twice.with(@ok_response)
expect(@call).to receive(:send_status).once.with(OK, 'OK') expect(@call).to receive(:send_status).once.with(OK, 'OK')
expect(@call).to receive(:finished).once
@server_streamer.run_server_method(@call, method(:fake_svstream)) @server_streamer.run_server_method(@call, method(:fake_svstream))
end end
end end
@ -207,6 +210,7 @@ describe GRPC::RpcDesc do
it 'closes the stream if there no errors' do it 'closes the stream if there no errors' do
expect(@call).to receive(:run_server_bidi) expect(@call).to receive(:run_server_bidi)
expect(@call).to receive(:send_status).once.with(OK, 'OK') expect(@call).to receive(:send_status).once.with(OK, 'OK')
expect(@call).to receive(:finished).once
@bidi_streamer.run_server_method(@call, method(:fake_bidistream)) @bidi_streamer.run_server_method(@call, method(:fake_bidistream))
end end
end end

Loading…
Cancel
Save