Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
cd22f119
Commit
cd22f119
authored
7 years ago
by
Alexander Polcyn
Browse files
Options
Downloads
Patches
Plain Diff
properly finish bidi calls when there is an initial error
parent
9511aefa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ruby/lib/grpc/generic/active_call.rb
+14
-1
14 additions, 1 deletion
src/ruby/lib/grpc/generic/active_call.rb
src/ruby/spec/generic/client_stub_spec.rb
+20
-6
20 additions, 6 deletions
src/ruby/spec/generic/client_stub_spec.rb
with
34 additions
and
7 deletions
src/ruby/lib/grpc/generic/active_call.rb
+
14
−
1
View file @
cd22f119
...
@@ -480,7 +480,20 @@ module GRPC
...
@@ -480,7 +480,20 @@ module GRPC
def
bidi_streamer
(
requests
,
metadata:
{},
&
blk
)
def
bidi_streamer
(
requests
,
metadata:
{},
&
blk
)
raise_error_if_already_executed
raise_error_if_already_executed
# Metadata might have already been sent if this is an operation view
# Metadata might have already been sent if this is an operation view
merge_metadata_and_send_if_not_already_sent
(
metadata
)
begin
merge_metadata_and_send_if_not_already_sent
(
metadata
)
rescue
GRPC
::
Core
::
CallError
=>
e
batch_result
=
@call
.
run_batch
(
RECV_STATUS_ON_CLIENT
=>
nil
)
set_input_stream_done
set_output_stream_done
attach_status_results_and_complete_call
(
batch_result
)
raise
e
rescue
=>
e
set_input_stream_done
set_output_stream_done
raise
e
end
bd
=
BidiCall
.
new
(
@call
,
bd
=
BidiCall
.
new
(
@call
,
@marshal
,
@marshal
,
@unmarshal
,
@unmarshal
,
...
...
This diff is collapsed.
Click to expand it.
src/ruby/spec/generic/client_stub_spec.rb
+
20
−
6
View file @
cd22f119
...
@@ -590,8 +590,22 @@ describe 'ClientStub' do
...
@@ -590,8 +590,22 @@ describe 'ClientStub' do
th
.
join
th
.
join
end
end
# TODO: add test for metadata-related ArgumentError in a bidi call once
it
'should raise ArgumentError if metadata contains invalid values'
do
# issue mentioned in https://github.com/grpc/grpc/issues/10526 is fixed
@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
it
'should send metadata to the server ok'
do
th
=
run_bidi_streamer_echo_ping_pong
(
@sent_msgs
,
@pass
,
true
,
th
=
run_bidi_streamer_echo_ping_pong
(
@sent_msgs
,
@pass
,
true
,
...
@@ -604,9 +618,9 @@ describe 'ClientStub' do
...
@@ -604,9 +618,9 @@ describe 'ClientStub' do
end
end
describe
'without a call operation'
do
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
,
e
=
stub
.
bidi_streamer
(
@method
,
@sent_msgs
,
noop
,
noop
,
metadata:
@metadata
)
metadata:
@metadata
,
deadline:
deadline
)
expect
(
e
).
to
be_a
(
Enumerator
)
expect
(
e
).
to
be_a
(
Enumerator
)
e
e
end
end
...
@@ -618,10 +632,10 @@ describe 'ClientStub' do
...
@@ -618,10 +632,10 @@ describe 'ClientStub' do
after
(
:each
)
do
after
(
:each
)
do
@op
.
wait
# make sure wait doesn't hang
@op
.
wait
# make sure wait doesn't hang
end
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
,
@op
=
stub
.
bidi_streamer
(
@method
,
@sent_msgs
,
noop
,
noop
,
return_op:
true
,
return_op:
true
,
metadata:
@metadata
)
metadata:
@metadata
,
deadline:
deadline
)
expect
(
@op
).
to
be_a
(
GRPC
::
ActiveCall
::
Operation
)
expect
(
@op
).
to
be_a
(
GRPC
::
ActiveCall
::
Operation
)
@op
.
start_call
if
run_start_call_first
@op
.
start_call
if
run_start_call_first
e
=
@op
.
execute
e
=
@op
.
execute
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment