Stop calling finish on server calls

pull/439/head
Tim Emiola 10 years ago
parent 9fd6770b1b
commit 1a22275e15
  1. 1
      src/ruby/lib/grpc/generic/rpc_desc.rb
  2. 9
      src/ruby/spec/generic/active_call_spec.rb
  3. 10
      src/ruby/spec/generic/client_stub_spec.rb
  4. 4
      src/ruby/spec/generic/rpc_desc_spec.rb

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

@ -166,7 +166,7 @@ describe GRPC::ActiveCall do
expect(client_call.remote_read).to eq('server_response')
end
it 'saves metadata { status=200 } when the server adds no metadata' do
it 'saves no metadata when the server adds no metadata' do
call = make_test_call
done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
deadline)
@ -180,7 +180,7 @@ describe GRPC::ActiveCall do
server_call.remote_send('ignore me')
expect(client_call.metadata).to be_nil
client_call.remote_read
expect(client_call.metadata).to eq(':status' => '200')
expect(client_call.metadata).to eq({})
end
it 'saves metadata add by the server' do
@ -197,7 +197,7 @@ describe GRPC::ActiveCall do
server_call.remote_send('ignore me')
expect(client_call.metadata).to be_nil
client_call.remote_read
expected = { ':status' => '200', 'k1' => 'v1', 'k2' => 'v2' }
expected = { 'k1' => 'v1', 'k2' => 'v2' }
expect(client_call.metadata).to eq(expected)
end
@ -307,7 +307,6 @@ describe GRPC::ActiveCall do
server_call.remote_send('server_response')
expect(client_call.remote_read).to eq('server_response')
server_call.send_status(OK, 'status code is OK')
expect { server_call.finished }.to_not raise_error
expect { client_call.finished }.to_not raise_error
end
@ -326,7 +325,6 @@ describe GRPC::ActiveCall do
server_call.send_status(OK, 'status code is OK')
expect(client_call.remote_read).to eq('server_response')
expect { client_call.writes_done(false) }.to_not raise_error
expect { server_call.finished }.to_not raise_error
expect { client_call.finished }.to_not raise_error
end
@ -345,7 +343,6 @@ describe GRPC::ActiveCall do
server_call.send_status(OK, 'status code is OK')
expect(client_call.remote_read).to eq('server_response')
expect { client_call.writes_done(true) }.to_not raise_error
expect { server_call.finished }.to_not raise_error
end
end

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

@ -94,7 +94,6 @@ describe GRPC::RpcDesc do
expect(@call).to receive(:remote_read).once.and_return(req)
expect(@call).to receive(:remote_send).once.with(@ok_response)
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))
end
end
@ -135,7 +134,6 @@ describe GRPC::RpcDesc 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(:send_status).once.with(OK, 'OK')
expect(@call).to receive(:finished).once
@client_streamer.run_server_method(@call, method(:fake_clstream))
end
end
@ -180,7 +178,6 @@ describe GRPC::RpcDesc do
expect(@call).to receive(:remote_read).once.and_return(req)
expect(@call).to receive(:remote_send).twice.with(@ok_response)
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))
end
end
@ -210,7 +207,6 @@ describe GRPC::RpcDesc do
it 'closes the stream if there no errors' do
expect(@call).to receive(:run_server_bidi)
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))
end
end

Loading…
Cancel
Save