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
ca5cdf45
Commit
ca5cdf45
authored
8 years ago
by
Noah Eisen
Browse files
Options
Downloads
Patches
Plain Diff
Add unimplemented_service test case for cpp interop client
parent
9785c8f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/cpp/interop/client.cc
+7
-2
7 additions, 2 deletions
test/cpp/interop/client.cc
test/cpp/interop/interop_client.cc
+26
-0
26 additions, 0 deletions
test/cpp/interop/interop_client.cc
test/cpp/interop/interop_client.h
+2
-0
2 additions, 0 deletions
test/cpp/interop/interop_client.h
with
35 additions
and
2 deletions
test/cpp/interop/client.cc
+
7
−
2
View file @
ca5cdf45
...
@@ -80,7 +80,8 @@ DEFINE_string(test_case, "large_unary",
...
@@ -80,7 +80,8 @@ DEFINE_string(test_case, "large_unary",
"slow client consumer;
\n
"
"slow client consumer;
\n
"
"status_code_and_message: verify status code & message;
\n
"
"status_code_and_message: verify status code & message;
\n
"
"timeout_on_sleeping_server: deadline exceeds on stream;
\n
"
"timeout_on_sleeping_server: deadline exceeds on stream;
\n
"
"unimplemented_method: client calls an unimplemented method;
\n
"
);
"unimplemented_method: client calls an unimplemented method;
\n
"
"unimplemented_service: client calls an unimplemented service;
\n
"
);
DEFINE_string
(
default_service_account
,
""
,
DEFINE_string
(
default_service_account
,
""
,
"Email of GCE default service account"
);
"Email of GCE default service account"
);
DEFINE_string
(
service_account_key_file
,
""
,
DEFINE_string
(
service_account_key_file
,
""
,
...
@@ -152,6 +153,8 @@ int main(int argc, char** argv) {
...
@@ -152,6 +153,8 @@ int main(int argc, char** argv) {
client
.
DoCustomMetadata
();
client
.
DoCustomMetadata
();
}
else
if
(
FLAGS_test_case
==
"unimplemented_method"
)
{
}
else
if
(
FLAGS_test_case
==
"unimplemented_method"
)
{
client
.
DoUnimplementedMethod
();
client
.
DoUnimplementedMethod
();
}
else
if
(
FLAGS_test_case
==
"unimplemented_service"
)
{
client
.
DoUnimplementedService
();
}
else
if
(
FLAGS_test_case
==
"cacheable_unary"
)
{
}
else
if
(
FLAGS_test_case
==
"cacheable_unary"
)
{
client
.
DoCacheableUnary
();
client
.
DoCacheableUnary
();
}
else
if
(
FLAGS_test_case
==
"all"
)
{
}
else
if
(
FLAGS_test_case
==
"all"
)
{
...
@@ -172,6 +175,7 @@ int main(int argc, char** argv) {
...
@@ -172,6 +175,7 @@ int main(int argc, char** argv) {
client
.
DoStatusWithMessage
();
client
.
DoStatusWithMessage
();
client
.
DoCustomMetadata
();
client
.
DoCustomMetadata
();
client
.
DoUnimplementedMethod
();
client
.
DoUnimplementedMethod
();
client
.
DoUnimplementedService
();
client
.
DoCacheableUnary
();
client
.
DoCacheableUnary
();
// service_account_creds and jwt_token_creds can only run with ssl.
// service_account_creds and jwt_token_creds can only run with ssl.
if
(
FLAGS_use_tls
)
{
if
(
FLAGS_use_tls
)
{
...
@@ -207,7 +211,8 @@ int main(int argc, char** argv) {
...
@@ -207,7 +211,8 @@ int main(int argc, char** argv) {
"server_streaming"
,
"server_streaming"
,
"status_code_and_message"
,
"status_code_and_message"
,
"timeout_on_sleeping_server"
,
"timeout_on_sleeping_server"
,
"unimplemented_method"
};
"unimplemented_method"
,
"unimplemented_service"
};
char
*
joined_testcases
=
char
*
joined_testcases
=
gpr_strjoin_sep
(
testcases
,
GPR_ARRAY_SIZE
(
testcases
),
"
\n
"
,
NULL
);
gpr_strjoin_sep
(
testcases
,
GPR_ARRAY_SIZE
(
testcases
),
"
\n
"
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
test/cpp/interop/interop_client.cc
+
26
−
0
View file @
ca5cdf45
...
@@ -107,6 +107,11 @@ TestService::Stub* InteropClient::ServiceStub::Get() {
...
@@ -107,6 +107,11 @@ TestService::Stub* InteropClient::ServiceStub::Get() {
return
stub_
.
get
();
return
stub_
.
get
();
}
}
UnimplementedService
::
Stub
*
InteropClient
::
ServiceStub
::
GetUnimplementedServiceStub
()
{
return
UnimplementedService
::
NewStub
(
channel_
).
get
();
}
void
InteropClient
::
ServiceStub
::
Reset
(
std
::
shared_ptr
<
Channel
>
channel
)
{
void
InteropClient
::
ServiceStub
::
Reset
(
std
::
shared_ptr
<
Channel
>
channel
)
{
channel_
=
channel
;
channel_
=
channel
;
...
@@ -1002,6 +1007,27 @@ bool InteropClient::DoCustomMetadata() {
...
@@ -1002,6 +1007,27 @@ bool InteropClient::DoCustomMetadata() {
return
true
;
return
true
;
}
}
bool
InteropClient
::
DoUnimplementedService
()
{
gpr_log
(
GPR_DEBUG
,
"Sending a request for an unimplemented service..."
);
Empty
request
=
Empty
::
default_instance
();
Empty
response
=
Empty
::
default_instance
();
ClientContext
context
;
UnimplementedService
::
Stub
*
stub
=
serviceStub_
.
GetUnimplementedServiceStub
();
Status
s
=
stub
->
UnimplementedCall
(
&
context
,
request
,
&
response
);
if
(
!
AssertStatusCode
(
s
,
StatusCode
::
UNIMPLEMENTED
))
{
return
false
;
}
gpr_log
(
GPR_DEBUG
,
"unimplemented service done."
);
return
true
;
}
bool
InteropClient
::
DoUnimplementedMethod
()
{
bool
InteropClient
::
DoUnimplementedMethod
()
{
gpr_log
(
GPR_DEBUG
,
"Sending a request for an unimplemented rpc..."
);
gpr_log
(
GPR_DEBUG
,
"Sending a request for an unimplemented rpc..."
);
...
...
This diff is collapsed.
Click to expand it.
test/cpp/interop/interop_client.h
+
2
−
0
View file @
ca5cdf45
...
@@ -80,6 +80,7 @@ class InteropClient {
...
@@ -80,6 +80,7 @@ class InteropClient {
bool
DoStatusWithMessage
();
bool
DoStatusWithMessage
();
bool
DoCustomMetadata
();
bool
DoCustomMetadata
();
bool
DoUnimplementedMethod
();
bool
DoUnimplementedMethod
();
bool
DoUnimplementedService
();
bool
DoCacheableUnary
();
bool
DoCacheableUnary
();
// Auth tests.
// Auth tests.
// username is a string containing the user email
// username is a string containing the user email
...
@@ -100,6 +101,7 @@ class InteropClient {
...
@@ -100,6 +101,7 @@ class InteropClient {
ServiceStub
(
std
::
shared_ptr
<
Channel
>
channel
,
bool
new_stub_every_call
);
ServiceStub
(
std
::
shared_ptr
<
Channel
>
channel
,
bool
new_stub_every_call
);
TestService
::
Stub
*
Get
();
TestService
::
Stub
*
Get
();
UnimplementedService
::
Stub
*
GetUnimplementedServiceStub
();
void
Reset
(
std
::
shared_ptr
<
Channel
>
channel
);
void
Reset
(
std
::
shared_ptr
<
Channel
>
channel
);
...
...
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