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
56610d47
Commit
56610d47
authored
8 years ago
by
ncteisen
Browse files
Options
Downloads
Patches
Plain Diff
Address github comments
parent
db8a3c28
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ruby/pb/test/client.rb
+16
-26
16 additions, 26 deletions
src/ruby/pb/test/client.rb
with
16 additions
and
26 deletions
src/ruby/pb/test/client.rb
+
16
−
26
View file @
56610d47
...
...
@@ -517,35 +517,30 @@ class NamedTests
def
unimplemented_method
begin
resp
=
@stub
.
unimplemented_call
(
Empty
.
new
)
rescue
GRPC
::
BadStatus
=>
e
if
e
.
code
!=
GRPC
::
Core
::
StatusCodes
::
UNIMPLEMENTED
fail
AssertionError
,
"Expected status 12 (UNIMPLEMENTED). Received:
#{
e
.
code
}
"
end
rescue
GRPC
::
Unimplemented
=>
e
return
rescue
Exception
=>
e
fail
AssertionError
,
"Expected BadStatus. Received:
#{
e
.
inspect
}
"
end
fail
AssertionError
,
"GRPC::Unimplemented should have been raised. Was not."
end
def
unimplemented_service
begin
resp
=
@stub
.
unimplemented_call
(
Empty
.
new
)
rescue
GRPC
::
BadStatus
=>
e
if
e
.
code
!=
GRPC
::
Core
::
StatusCodes
::
UNIMPLEMENTED
fail
AssertionError
,
"Expected status 12 (UNIMPLEMENTED). Received:
#{
e
.
code
}
"
end
rescue
GRPC
::
Unimplemented
=>
e
return
rescue
Exception
=>
e
fail
AssertionError
,
"Expected BadStatus. Received:
#{
e
.
inspect
}
"
end
fail
AssertionError
,
"GRPC::Unimplemented should have been raised. Was not."
end
def
status_code_and_message
# Function wide constants.
message
=
"test status method"
code
=
2
status
=
GRPC
::
Core
::
StatusCodes
::
UNKNOWN
code
=
GRPC
::
Core
::
StatusCodes
::
UNKNOWN
# Testing with UnaryCall.
payload
=
Payload
.
new
(
type: :COMPRESSABLE
,
body:
nulls
(
1
))
...
...
@@ -557,11 +552,8 @@ class NamedTests
seen_correct_exception
=
false
begin
resp
=
@stub
.
unary_call
(
req
)
rescue
GRPC
::
BadStatus
=>
e
if
e
.
code
!=
status
fail
AssertionError
,
"Expected status 2 (UNKOWN). Received:
#{
e
.
code
}
"
elsif
e
.
details
!=
message
rescue
GRPC
::
Unknown
=>
e
if
e
.
details
!=
message
fail
AssertionError
,
"Expected message
#{
message
}
. Received:
#{
e
.
details
}
"
end
...
...
@@ -584,11 +576,8 @@ class NamedTests
begin
resp
=
@stub
.
full_duplex_call
([
duplex_req
])
resp
.
next
# triggers initial req to be sent
rescue
GRPC
::
BadStatus
=>
e
if
e
.
code
!=
status
fail
AssertionError
,
"Expected status 2 (UNKOWN). Received:
#{
e
.
code
}
"
elsif
e
.
details
!=
message
rescue
GRPC
::
Unknown
=>
e
if
e
.
details
!=
message
fail
AssertionError
,
"Expected message
#{
message
}
. Received:
#{
e
.
details
}
"
end
...
...
@@ -607,6 +596,7 @@ class NamedTests
def
custom_metadata
# Function wide constants
req_size
,
wanted_response_size
=
271_828
,
314_159
initial_metadata_key
=
"x-grpc-test-echo-initial"
initial_metadata_value
=
"test_initial_metadata_value"
trailing_metadata_key
=
"x-grpc-test-echo-trailing-bin"
...
...
@@ -618,9 +608,9 @@ class NamedTests
}
# Testing with UnaryCall
payload
=
Payload
.
new
(
type: :COMPRESSABLE
,
body:
nulls
(
1
))
payload
=
Payload
.
new
(
type: :COMPRESSABLE
,
body:
nulls
(
req_size
))
req
=
SimpleRequest
.
new
(
response_type: :COMPRESSABLE
,
response_size:
1
,
response_size:
wanted_response_size
,
payload:
payload
)
op
=
@stub
.
unary_call
(
req
,
metadata:
metadata
,
return_op:
true
)
...
...
@@ -643,9 +633,9 @@ class NamedTests
# Testing with FullDuplex
req_cls
,
p_cls
=
StreamingOutputCallRequest
,
ResponseParameters
duplex_req
=
req_cls
.
new
(
payload:
Payload
.
new
(
body:
nulls
(
1
)),
duplex_req
=
req_cls
.
new
(
payload:
Payload
.
new
(
body:
nulls
(
req_size
)),
response_type: :COMPRESSABLE
,
response_parameters:
[
p_cls
.
new
(
size:
1
)])
response_parameters:
[
p_cls
.
new
(
size:
wanted_response_size
)])
duplex_op
=
@stub
.
full_duplex_call
([
duplex_req
],
metadata:
metadata
,
return_op:
true
)
...
...
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