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
5a326dec
Commit
5a326dec
authored
9 years ago
by
Nathaniel Manista
Browse files
Options
Downloads
Plain Diff
Merge pull request #2880 from soltanmm/timeout-interop
Implement timeout interop test for Python.
parents
801bbeb7
9adf796d
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/python/grpcio_test/grpc_interop/_interop_test_case.py
+3
-0
3 additions, 0 deletions
src/python/grpcio_test/grpc_interop/_interop_test_case.py
src/python/grpcio_test/grpc_interop/methods.py
+23
-0
23 additions, 0 deletions
src/python/grpcio_test/grpc_interop/methods.py
with
26 additions
and
0 deletions
src/python/grpcio_test/grpc_interop/_interop_test_case.py
+
3
−
0
View file @
5a326dec
...
@@ -59,3 +59,6 @@ class InteropTestCase(object):
...
@@ -59,3 +59,6 @@ class InteropTestCase(object):
def
testCancelAfterFirstResponse
(
self
):
def
testCancelAfterFirstResponse
(
self
):
methods
.
TestCase
.
CANCEL_AFTER_FIRST_RESPONSE
.
test_interoperability
(
self
.
stub
,
None
)
methods
.
TestCase
.
CANCEL_AFTER_FIRST_RESPONSE
.
test_interoperability
(
self
.
stub
,
None
)
def
testTimeoutOnSleepingServer
(
self
):
methods
.
TestCase
.
TIMEOUT_ON_SLEEPING_SERVER
.
test_interoperability
(
self
.
stub
,
None
)
This diff is collapsed.
Click to expand it.
src/python/grpcio_test/grpc_interop/methods.py
+
23
−
0
View file @
5a326dec
...
@@ -33,10 +33,12 @@ import enum
...
@@ -33,10 +33,12 @@ import enum
import
json
import
json
import
os
import
os
import
threading
import
threading
import
time
from
oauth2client
import
client
as
oauth2client_client
from
oauth2client
import
client
as
oauth2client_client
from
grpc.framework.alpha
import
utilities
from
grpc.framework.alpha
import
utilities
from
grpc.framework.alpha
import
exceptions
from
grpc_interop
import
empty_pb2
from
grpc_interop
import
empty_pb2
from
grpc_interop
import
messages_pb2
from
grpc_interop
import
messages_pb2
...
@@ -318,6 +320,24 @@ def _cancel_after_first_response(stub):
...
@@ -318,6 +320,24 @@ def _cancel_after_first_response(stub):
raise
ValueError
(
'
expected call to be cancelled
'
)
raise
ValueError
(
'
expected call to be cancelled
'
)
def
_timeout_on_sleeping_server
(
stub
):
request_payload_size
=
27182
with
stub
,
_Pipe
()
as
pipe
:
response_iterator
=
stub
.
FullDuplexCall
(
pipe
,
0.001
)
request
=
messages_pb2
.
StreamingOutputCallRequest
(
response_type
=
messages_pb2
.
COMPRESSABLE
,
payload
=
messages_pb2
.
Payload
(
body
=
b
'
\x00
'
*
request_payload_size
))
pipe
.
add
(
request
)
time
.
sleep
(
0.1
)
try
:
next
(
response_iterator
)
except
exceptions
.
ExpirationError
:
pass
else
:
raise
ValueError
(
'
expected call to exceed deadline
'
)
def
_compute_engine_creds
(
stub
,
args
):
def
_compute_engine_creds
(
stub
,
args
):
response
=
_large_unary_common_behavior
(
stub
,
True
,
True
)
response
=
_large_unary_common_behavior
(
stub
,
True
,
True
)
if
args
.
default_service_account
!=
response
.
username
:
if
args
.
default_service_account
!=
response
.
username
:
...
@@ -351,6 +371,7 @@ class TestCase(enum.Enum):
...
@@ -351,6 +371,7 @@ class TestCase(enum.Enum):
CANCEL_AFTER_FIRST_RESPONSE
=
'
cancel_after_first_response
'
CANCEL_AFTER_FIRST_RESPONSE
=
'
cancel_after_first_response
'
COMPUTE_ENGINE_CREDS
=
'
compute_engine_creds
'
COMPUTE_ENGINE_CREDS
=
'
compute_engine_creds
'
SERVICE_ACCOUNT_CREDS
=
'
service_account_creds
'
SERVICE_ACCOUNT_CREDS
=
'
service_account_creds
'
TIMEOUT_ON_SLEEPING_SERVER
=
'
timeout_on_sleeping_server
'
def
test_interoperability
(
self
,
stub
,
args
):
def
test_interoperability
(
self
,
stub
,
args
):
if
self
is
TestCase
.
EMPTY_UNARY
:
if
self
is
TestCase
.
EMPTY_UNARY
:
...
@@ -367,6 +388,8 @@ class TestCase(enum.Enum):
...
@@ -367,6 +388,8 @@ class TestCase(enum.Enum):
_cancel_after_begin
(
stub
)
_cancel_after_begin
(
stub
)
elif
self
is
TestCase
.
CANCEL_AFTER_FIRST_RESPONSE
:
elif
self
is
TestCase
.
CANCEL_AFTER_FIRST_RESPONSE
:
_cancel_after_first_response
(
stub
)
_cancel_after_first_response
(
stub
)
elif
self
is
TestCase
.
TIMEOUT_ON_SLEEPING_SERVER
:
_timeout_on_sleeping_server
(
stub
)
elif
self
is
TestCase
.
COMPUTE_ENGINE_CREDS
:
elif
self
is
TestCase
.
COMPUTE_ENGINE_CREDS
:
_compute_engine_creds
(
stub
,
args
)
_compute_engine_creds
(
stub
,
args
)
elif
self
is
TestCase
.
SERVICE_ACCOUNT_CREDS
:
elif
self
is
TestCase
.
SERVICE_ACCOUNT_CREDS
:
...
...
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