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
a5d39f7e
Commit
a5d39f7e
authored
9 years ago
by
Tim Emiola
Browse files
Options
Downloads
Patches
Plain Diff
Merges timeout interop test change
parent
6cc17157
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ruby/bin/interop/interop_client.rb
+49
-2
49 additions, 2 deletions
src/ruby/bin/interop/interop_client.rb
with
49 additions
and
2 deletions
src/ruby/bin/interop/interop_client.rb
+
49
−
2
View file @
a5d39f7e
...
@@ -110,6 +110,14 @@ def create_stub(opts)
...
@@ -110,6 +110,14 @@ def create_stub(opts)
end
end
end
end
if
opts
.
test_case
==
'oauth2_auth_token'
auth_creds
=
Google
::
Auth
.
get_application_default
(
opts
.
oauth_scope
)
kw
=
auth_creds
.
updater_proc
.
call
({})
# gives as an auth token
# use a metadata update proc that just adds the auth token.
stub_opts
[
:update_metadata
]
=
proc
{
|
md
|
md
.
merge
(
kw
)
}
end
if
opts
.
test_case
==
'jwt_token_creds'
# don't use a scope
if
opts
.
test_case
==
'jwt_token_creds'
# don't use a scope
auth_creds
=
Google
::
Auth
.
get_application_default
auth_creds
=
Google
::
Auth
.
get_application_default
stub_opts
[
:update_metadata
]
=
auth_creds
.
updater_proc
stub_opts
[
:update_metadata
]
=
auth_creds
.
updater_proc
...
@@ -228,6 +236,33 @@ class NamedTests
...
@@ -228,6 +236,33 @@ class NamedTests
p
'OK: compute_engine_creds'
p
'OK: compute_engine_creds'
end
end
def
oauth2_auth_token
resp
=
perform_large_unary
(
fill_username:
true
,
fill_oauth_scope:
true
)
json_key
=
File
.
read
(
ENV
[
AUTH_ENV
])
wanted_email
=
MultiJson
.
load
(
json_key
)[
'client_email'
]
assert_equal
(
wanted_email
,
resp
.
username
,
"
#{
__callee__
}
: incorrect username"
)
assert
(
@args
.
oauth_scope
.
include?
(
resp
.
oauth_scope
),
"
#{
__callee__
}
: incorrect oauth_scope"
)
p
"OK:
#{
__callee__
}
"
end
def
per_rpc_creds
auth_creds
=
Google
::
Auth
.
get_application_default
(
@args
.
oauth_scope
)
kw
=
auth_creds
.
updater_proc
.
call
({})
resp
=
perform_large_unary
(
fill_username:
true
,
fill_oauth_scope:
true
,
**
kw
)
json_key
=
File
.
read
(
ENV
[
AUTH_ENV
])
wanted_email
=
MultiJson
.
load
(
json_key
)[
'client_email'
]
assert_equal
(
wanted_email
,
resp
.
username
,
"
#{
__callee__
}
: incorrect username"
)
assert
(
@args
.
oauth_scope
.
include?
(
resp
.
oauth_scope
),
"
#{
__callee__
}
: incorrect oauth_scope"
)
p
"OK:
#{
__callee__
}
"
end
def
client_streaming
def
client_streaming
msg_sizes
=
[
27_182
,
8
,
1828
,
45_904
]
msg_sizes
=
[
27_182
,
8
,
1828
,
45_904
]
wanted_aggregate_size
=
74_922
wanted_aggregate_size
=
74_922
...
@@ -276,6 +311,18 @@ class NamedTests
...
@@ -276,6 +311,18 @@ class NamedTests
p
"OK:
#{
__callee__
}
"
p
"OK:
#{
__callee__
}
"
end
end
def
empty_stream
ppp
=
PingPongPlayer
.
new
([])
resps
=
@stub
.
full_duplex_call
(
ppp
.
each_item
)
count
=
0
resps
.
each
do
|
r
|
ppp
.
queue
.
push
(
r
)
count
+=
1
end
assert_equal
(
0
,
count
,
'too many responses, expect 0'
)
p
'OK: empty_stream'
end
def
cancel_after_begin
def
cancel_after_begin
msg_sizes
=
[
27_182
,
8
,
1828
,
45_904
]
msg_sizes
=
[
27_182
,
8
,
1828
,
45_904
]
reqs
=
msg_sizes
.
map
do
|
x
|
reqs
=
msg_sizes
.
map
do
|
x
|
...
@@ -311,7 +358,7 @@ class NamedTests
...
@@ -311,7 +358,7 @@ class NamedTests
private
private
def
perform_large_unary
(
fill_username:
false
,
fill_oauth_scope:
false
)
def
perform_large_unary
(
fill_username:
false
,
fill_oauth_scope:
false
,
**
kw
)
req_size
,
wanted_response_size
=
271_828
,
314_159
req_size
,
wanted_response_size
=
271_828
,
314_159
payload
=
Payload
.
new
(
type: :COMPRESSABLE
,
body:
nulls
(
req_size
))
payload
=
Payload
.
new
(
type: :COMPRESSABLE
,
body:
nulls
(
req_size
))
req
=
SimpleRequest
.
new
(
response_type: :COMPRESSABLE
,
req
=
SimpleRequest
.
new
(
response_type: :COMPRESSABLE
,
...
@@ -319,7 +366,7 @@ class NamedTests
...
@@ -319,7 +366,7 @@ class NamedTests
payload:
payload
)
payload:
payload
)
req
.
fill_username
=
fill_username
req
.
fill_username
=
fill_username
req
.
fill_oauth_scope
=
fill_oauth_scope
req
.
fill_oauth_scope
=
fill_oauth_scope
resp
=
@stub
.
unary_call
(
req
)
resp
=
@stub
.
unary_call
(
req
,
**
kw
)
assert_equal
(
:COMPRESSABLE
,
resp
.
payload
.
type
,
assert_equal
(
:COMPRESSABLE
,
resp
.
payload
.
type
,
'large_unary: payload had the wrong type'
)
'large_unary: payload had the wrong type'
)
assert_equal
(
wanted_response_size
,
resp
.
payload
.
body
.
length
,
assert_equal
(
wanted_response_size
,
resp
.
payload
.
body
.
length
,
...
...
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