aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-02-09 13:26:35 -0800
committerGravatar Michael Lumish <mlumish@google.com>2015-02-09 13:26:35 -0800
commitbc8169ef8e78618c5d51e6b98b8c80fb9e8ed777 (patch)
tree4fa100581e74391cdf4db30fcb7415e8052016ec
parent3c4cb79b0fcff34ab441811b5762843a3d5d140d (diff)
parent1a22275e1570a78495d7abadab78092611027a8d (diff)
Merge pull request #439 from tbetbetbe/grpc_ruby_update_after_c_core_changes
Grpc ruby update after c core changes
-rwxr-xr-xsrc/ruby/bin/math_client.rb2
-rw-r--r--src/ruby/ext/grpc/rb_event.c11
-rw-r--r--src/ruby/lib/grpc/generic/rpc_desc.rb1
-rw-r--r--src/ruby/spec/call_spec.rb8
-rw-r--r--src/ruby/spec/client_server_spec.rb5
-rw-r--r--src/ruby/spec/event_spec.rb4
-rw-r--r--src/ruby/spec/generic/active_call_spec.rb9
-rw-r--r--src/ruby/spec/generic/client_stub_spec.rb10
-rw-r--r--src/ruby/spec/generic/rpc_desc_spec.rb4
9 files changed, 18 insertions, 36 deletions
diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb
index 195406c8b3..7e838e23d1 100755
--- a/src/ruby/bin/math_client.rb
+++ b/src/ruby/bin/math_client.rb
@@ -83,7 +83,7 @@ def do_div_many(stub)
logger.info('-------------')
reqs = []
reqs << Math::DivArgs.new(dividend: 7, divisor: 3)
- reqs << Math::Di5AvArgs.new(dividend: 5, divisor: 2)
+ reqs << Math::DivArgs.new(dividend: 5, divisor: 2)
reqs << Math::DivArgs.new(dividend: 7, divisor: 2)
logger.info("div(7/3), div(5/2), div(7/2): reqs=#{reqs.inspect}")
resp = stub.div_many(reqs, 10)
diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c
index a1ab6251c8..72c9dd2ec0 100644
--- a/src/ruby/ext/grpc/rb_event.c
+++ b/src/ruby/ext/grpc/rb_event.c
@@ -256,14 +256,6 @@ static VALUE grpc_rb_event_result(VALUE self) {
event->data.finish_accepted);
break;
- case GRPC_INVOKE_ACCEPTED:
- if (event->data.invoke_accepted == GRPC_OP_OK) {
- return Qnil;
- }
- rb_raise(rb_eEventError, "invoke failed, not sure why (code=%d)",
- event->data.invoke_accepted);
- break;
-
case GRPC_WRITE_ACCEPTED:
if (event->data.write_accepted == GRPC_OP_OK) {
return Qnil;
@@ -343,9 +335,8 @@ void Init_google_rpc_event() {
rb_define_module_under(rb_mGoogleRpcCore, "CompletionType");
rb_define_const(rb_mCompletionType, "QUEUE_SHUTDOWN",
INT2NUM(GRPC_QUEUE_SHUTDOWN));
+ rb_define_const(rb_mCompletionType, "OP_COMPLETE", INT2NUM(GRPC_OP_COMPLETE));
rb_define_const(rb_mCompletionType, "READ", INT2NUM(GRPC_READ));
- rb_define_const(rb_mCompletionType, "INVOKE_ACCEPTED",
- INT2NUM(GRPC_INVOKE_ACCEPTED));
rb_define_const(rb_mCompletionType, "WRITE_ACCEPTED",
INT2NUM(GRPC_WRITE_ACCEPTED));
rb_define_const(rb_mCompletionType, "FINISH_ACCEPTED",
diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb
index e1aa33e318..876397a6e7 100644
--- a/src/ruby/lib/grpc/generic/rpc_desc.rb
+++ b/src/ruby/lib/grpc/generic/rpc_desc.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.
diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb
index c793284488..8bb5043186 100644
--- a/src/ruby/spec/call_spec.rb
+++ b/src/ruby/spec/call_spec.rb
@@ -75,14 +75,14 @@ describe GRPC::Core::Call do
end
describe '#start_read' do
- it 'should fail if called immediately' do
+ xit 'should fail if called immediately' do
blk = proc { make_test_call.start_read(@tag) }
expect(&blk).to raise_error GRPC::Core::CallError
end
end
describe '#start_write' do
- it 'should fail if called immediately' do
+ xit 'should fail if called immediately' do
bytes = GRPC::Core::ByteBuffer.new('test string')
blk = proc { make_test_call.start_write(bytes, @tag) }
expect(&blk).to raise_error GRPC::Core::CallError
@@ -90,14 +90,14 @@ describe GRPC::Core::Call do
end
describe '#start_write_status' do
- it 'should fail if called immediately' do
+ xit 'should fail if called immediately' do
blk = proc { make_test_call.start_write_status(153, 'x', @tag) }
expect(&blk).to raise_error GRPC::Core::CallError
end
end
describe '#writes_done' do
- it 'should fail if called immediately' do
+ xit 'should fail if called immediately' do
blk = proc { make_test_call.writes_done(Object.new) }
expect(&blk).to raise_error GRPC::Core::CallError
end
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index 96b8ef4300..f5acae896a 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -292,10 +292,10 @@ shared_examples 'GRPC metadata delivery works OK' do
# TODO: update this with the bug number to be resolved
ev = expect_next_event_on(@client_queue, CLIENT_METADATA_READ,
@client_metadata_tag)
- expect(ev.result).to eq(':status' => '200')
+ expect(ev.result).to eq({})
end
- it 'sends all the pairs and status:200 when keys and values are valid' do
+ it 'sends all the pairs when keys and values are valid' do
@valid_metadata.each do |md|
call = new_client_call
call.invoke(@client_queue, @client_metadata_tag, @client_finished_tag)
@@ -314,7 +314,6 @@ shared_examples 'GRPC metadata delivery works OK' do
ev = expect_next_event_on(@client_queue, CLIENT_METADATA_READ,
@client_metadata_tag)
replace_symbols = Hash[md.each_pair.collect { |x, y| [x.to_s, y] }]
- replace_symbols[':status'] = '200'
expect(ev.result).to eq(replace_symbols)
end
end
diff --git a/src/ruby/spec/event_spec.rb b/src/ruby/spec/event_spec.rb
index 7ef08d021b..89acd4ba67 100644
--- a/src/ruby/spec/event_spec.rb
+++ b/src/ruby/spec/event_spec.rb
@@ -33,8 +33,8 @@ describe GRPC::Core::CompletionType do
before(:each) do
@known_types = {
QUEUE_SHUTDOWN: 0,
- READ: 1,
- INVOKE_ACCEPTED: 2,
+ OP_COMPLETE: 1,
+ READ: 2,
WRITE_ACCEPTED: 3,
FINISH_ACCEPTED: 4,
CLIENT_METADATA_READ: 5,
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb
index 599e68bef0..86495d7369 100644
--- a/src/ruby/spec/generic/active_call_spec.rb
+++ b/src/ruby/spec/generic/active_call_spec.rb
@@ -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
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index f1500fbd44..c7218da2cf 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -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
diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb
index ac0b5c51f4..54ccf7ab8b 100644
--- a/src/ruby/spec/generic/rpc_desc_spec.rb
+++ b/src/ruby/spec/generic/rpc_desc_spec.rb
@@ -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