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
bfe8a9fe
Commit
bfe8a9fe
authored
9 years ago
by
Tim Emiola
Browse files
Options
Downloads
Patches
Plain Diff
Fixes the broken ruby interop tests
parent
b53b36e2
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/client_stub.rb
+14
-8
14 additions, 8 deletions
src/ruby/lib/grpc/generic/client_stub.rb
src/ruby/spec/generic/client_stub_spec.rb
+14
-0
14 additions, 0 deletions
src/ruby/spec/generic/client_stub_spec.rb
with
28 additions
and
8 deletions
src/ruby/lib/grpc/generic/client_stub.rb
+
14
−
8
View file @
bfe8a9fe
...
@@ -176,8 +176,7 @@ module GRPC
...
@@ -176,8 +176,7 @@ module GRPC
deadline:
deadline
,
deadline:
deadline
,
timeout:
timeout
,
timeout:
timeout
,
parent:
parent
)
parent:
parent
)
kw_with_jwt_uri
=
self
.
class
.
update_with_jwt_aud_uri
(
kw
,
@host
,
method
)
md
=
update_metadata
(
kw
,
method
)
md
=
@update_metadata
.
nil?
?
kw
:
@update_metadata
.
call
(
kw_with_jwt_uri
)
return
c
.
request_response
(
req
,
**
md
)
unless
return_op
return
c
.
request_response
(
req
,
**
md
)
unless
return_op
# return the operation view of the active_call; define #execute as a
# return the operation view of the active_call; define #execute as a
...
@@ -244,8 +243,7 @@ module GRPC
...
@@ -244,8 +243,7 @@ module GRPC
deadline:
deadline
,
deadline:
deadline
,
timeout:
timeout
,
timeout:
timeout
,
parent:
parent
)
parent:
parent
)
kw_with_jwt_uri
=
self
.
class
.
update_with_jwt_aud_uri
(
kw
,
@host
,
method
)
md
=
update_metadata
(
kw
,
method
)
md
=
@update_metadata
.
nil?
?
kw
:
@update_metadata
.
call
(
kw_with_jwt_uri
)
return
c
.
client_streamer
(
requests
,
**
md
)
unless
return_op
return
c
.
client_streamer
(
requests
,
**
md
)
unless
return_op
# return the operation view of the active_call; define #execute as a
# return the operation view of the active_call; define #execute as a
...
@@ -322,8 +320,7 @@ module GRPC
...
@@ -322,8 +320,7 @@ module GRPC
deadline:
deadline
,
deadline:
deadline
,
timeout:
timeout
,
timeout:
timeout
,
parent:
parent
)
parent:
parent
)
kw_with_jwt_uri
=
self
.
class
.
update_with_jwt_aud_uri
(
kw
,
@host
,
method
)
md
=
update_metadata
(
kw
,
method
)
md
=
@update_metadata
.
nil?
?
kw
:
@update_metadata
.
call
(
kw_with_jwt_uri
)
return
c
.
server_streamer
(
req
,
**
md
,
&
blk
)
unless
return_op
return
c
.
server_streamer
(
req
,
**
md
,
&
blk
)
unless
return_op
# return the operation view of the active_call; define #execute
# return the operation view of the active_call; define #execute
...
@@ -439,8 +436,7 @@ module GRPC
...
@@ -439,8 +436,7 @@ module GRPC
deadline:
deadline
,
deadline:
deadline
,
timeout:
timeout
,
timeout:
timeout
,
parent:
parent
)
parent:
parent
)
kw_with_jwt_uri
=
self
.
class
.
update_with_jwt_aud_uri
(
kw
,
@host
,
method
)
md
=
update_metadata
(
kw
,
method
)
md
=
@update_metadata
.
nil?
?
kw
:
@update_metadata
.
call
(
kw_with_jwt_uri
)
return
c
.
bidi_streamer
(
requests
,
**
md
,
&
blk
)
unless
return_op
return
c
.
bidi_streamer
(
requests
,
**
md
,
&
blk
)
unless
return_op
# return the operation view of the active_call; define #execute
# return the operation view of the active_call; define #execute
...
@@ -454,6 +450,16 @@ module GRPC
...
@@ -454,6 +450,16 @@ module GRPC
private
private
def
update_metadata
(
kw
,
method
)
return
kw
if
@update_metadata
.
nil?
just_jwt_uri
=
self
.
class
.
update_with_jwt_aud_uri
({},
@host
,
method
)
updated
=
@update_metadata
.
call
(
just_jwt_uri
)
# keys should be lowercase
updated
=
Hash
[
updated
.
each_pair
.
map
{
|
k
,
v
|
[
k
.
downcase
,
v
]
}]
kw
.
merge
(
updated
)
end
# Creates a new active stub
# Creates a new active stub
#
#
# @param method [string] the method being called.
# @param method [string] the method being called.
...
...
This diff is collapsed.
Click to expand it.
src/ruby/spec/generic/client_stub_spec.rb
+
14
−
0
View file @
bfe8a9fe
...
@@ -159,6 +159,20 @@ describe 'ClientStub' do
...
@@ -159,6 +159,20 @@ describe 'ClientStub' do
th
.
join
th
.
join
end
end
it
'should downcase the keys provided by the metadata updater'
do
server_port
=
create_test_server
host
=
"localhost:
#{
server_port
}
"
th
=
run_request_response
(
@sent_msg
,
@resp
,
@pass
,
k1:
'downcased-key-v1'
,
k2:
'v2'
)
update_md
=
proc
do
|
md
|
md
[
:K1
]
=
'downcased-key-v1'
md
end
stub
=
GRPC
::
ClientStub
.
new
(
host
,
@cq
,
update_metadata:
update_md
)
expect
(
get_response
(
stub
)).
to
eq
(
@resp
)
th
.
join
end
it
'should send a request when configured using an override channel'
do
it
'should send a request when configured using an override channel'
do
server_port
=
create_test_server
server_port
=
create_test_server
alt_host
=
"localhost:
#{
server_port
}
"
alt_host
=
"localhost:
#{
server_port
}
"
...
...
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