aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec
diff options
context:
space:
mode:
authorGravatar apolcyn <apolcyn@google.com>2017-07-27 22:27:54 -0700
committerGravatar GitHub <noreply@github.com>2017-07-27 22:27:54 -0700
commitcace6a9e4f9e5d1d75ff429127d16aa1eee6040e (patch)
tree8e7208ae6125e4d47948bf054c3adc37ee382145 /src/ruby/spec
parenta4da109081aa2b25c6c6561a684ab578e9efb5b7 (diff)
parentcd22f11905dacc72f08b0255c1cf73d0cea4c7c2 (diff)
Merge pull request #11963 from apolcyn/fix_ruby_bidi_error_terminate
Improve completion of bidi calls when there is an initial error
Diffstat (limited to 'src/ruby/spec')
-rw-r--r--src/ruby/spec/generic/client_stub_spec.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index 42cff4041b..e1e7a535fb 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -616,8 +616,22 @@ describe 'ClientStub' do
th.join
end
- # TODO: add test for metadata-related ArgumentError in a bidi call once
- # issue mentioned in https://github.com/grpc/grpc/issues/10526 is fixed
+ it 'should raise ArgumentError if metadata contains invalid values' do
+ @metadata.merge!(k3: 3)
+ stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
+ expect do
+ get_responses(stub).collect { |r| r }
+ end.to raise_error(ArgumentError,
+ /Header values must be of type string or array/)
+ end
+
+ it 'terminates if the call fails to start' do
+ # don't start the server
+ stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
+ expect do
+ get_responses(stub, deadline: from_relative_time(0)).collect { |r| r }
+ end.to raise_error(GRPC::BadStatus)
+ end
it 'should send metadata to the server ok' do
th = run_bidi_streamer_echo_ping_pong(@sent_msgs, @pass, true,
@@ -630,9 +644,9 @@ describe 'ClientStub' do
end
describe 'without a call operation' do
- def get_responses(stub)
+ def get_responses(stub, deadline: nil)
e = stub.bidi_streamer(@method, @sent_msgs, noop, noop,
- metadata: @metadata)
+ metadata: @metadata, deadline: deadline)
expect(e).to be_a(Enumerator)
e
end
@@ -644,10 +658,10 @@ describe 'ClientStub' do
after(:each) do
@op.wait # make sure wait doesn't hang
end
- def get_responses(stub, run_start_call_first: false)
+ def get_responses(stub, run_start_call_first: false, deadline: nil)
@op = stub.bidi_streamer(@method, @sent_msgs, noop, noop,
return_op: true,
- metadata: @metadata)
+ metadata: @metadata, deadline: deadline)
expect(@op).to be_a(GRPC::ActiveCall::Operation)
@op.start_call if run_start_call_first
e = @op.execute