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
2c3be1df
Commit
2c3be1df
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for C++ propagation
parent
e40f964e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/grpc++/client_context.h
+9
-9
9 additions, 9 deletions
include/grpc++/client_context.h
src/cpp/client/client_context.cc
+5
-5
5 additions, 5 deletions
src/cpp/client/client_context.cc
test/cpp/end2end/end2end_test.cc
+81
-41
81 additions, 41 deletions
test/cpp/end2end/end2end_test.cc
with
95 additions
and
55 deletions
include/grpc++/client_context.h
+
9
−
9
View file @
2c3be1df
...
@@ -85,23 +85,23 @@ class PropagationOptions {
...
@@ -85,23 +85,23 @@ class PropagationOptions {
return
*
this
;
return
*
this
;
}
}
PropagationOptions
&
enable_stats_propagation
()
{
PropagationOptions
&
enable_
census_
stats_propagation
()
{
propagate_
|=
GRPC_PROPAGATE_STATS_CONTEXT
;
propagate_
|=
GRPC_PROPAGATE_
CENSUS_
STATS_CONTEXT
;
return
*
this
;
return
*
this
;
}
}
PropagationOptions
&
disable_stats_propagation
()
{
PropagationOptions
&
disable_
census_
stats_propagation
()
{
propagate_
&=
~
GRPC_PROPAGATE_STATS_CONTEXT
;
propagate_
&=
~
GRPC_PROPAGATE_
CENSUS_
STATS_CONTEXT
;
return
*
this
;
return
*
this
;
}
}
PropagationOptions
&
enable_tracing_propagation
()
{
PropagationOptions
&
enable_
census_
tracing_propagation
()
{
propagate_
|=
GRPC_PROPAGATE_TRACING_CONTEXT
;
propagate_
|=
GRPC_PROPAGATE_
CENSUS_
TRACING_CONTEXT
;
return
*
this
;
return
*
this
;
}
}
PropagationOptions
&
disable_tracing_propagation
()
{
PropagationOptions
&
disable_
census_
tracing_propagation
()
{
propagate_
&=
~
GRPC_PROPAGATE_TRACING_CONTEXT
;
propagate_
&=
~
GRPC_PROPAGATE_
CENSUS_
TRACING_CONTEXT
;
return
*
this
;
return
*
this
;
}
}
...
@@ -127,7 +127,7 @@ class ClientContext {
...
@@ -127,7 +127,7 @@ class ClientContext {
~
ClientContext
();
~
ClientContext
();
/// Create a new ClientContext that propagates some or all of its attributes
/// Create a new ClientContext that propagates some or all of its attributes
static
ClientContext
FromServerContext
(
static
std
::
unique_ptr
<
ClientContext
>
FromServerContext
(
const
ServerContext
&
server_context
,
const
ServerContext
&
server_context
,
PropagationOptions
options
=
PropagationOptions
());
PropagationOptions
options
=
PropagationOptions
());
...
...
This diff is collapsed.
Click to expand it.
src/cpp/client/client_context.cc
+
5
−
5
View file @
2c3be1df
...
@@ -66,11 +66,11 @@ ClientContext::~ClientContext() {
...
@@ -66,11 +66,11 @@ ClientContext::~ClientContext() {
}
}
}
}
ClientContext
ClientContext
::
FromServerContext
(
const
ServerContext
&
context
,
std
::
unique_ptr
<
ClientContext
>
ClientContext
::
FromServerContext
(
PropagationOptions
options
)
{
const
ServerContext
&
context
,
PropagationOptions
options
)
{
ClientContext
ctx
;
std
::
unique_ptr
<
ClientContext
>
ctx
(
new
ClientContext
)
;
ctx
.
propagate_from_call_
=
context
.
call_
;
ctx
->
propagate_from_call_
=
context
.
call_
;
ctx
.
propagation_options_
=
options
;
ctx
->
propagation_options_
=
options
;
return
ctx
;
return
ctx
;
}
}
...
...
This diff is collapsed.
Click to expand it.
test/cpp/end2end/end2end_test.cc
+
81
−
41
View file @
2c3be1df
...
@@ -104,6 +104,22 @@ bool CheckIsLocalhost(const grpc::string& addr) {
...
@@ -104,6 +104,22 @@ bool CheckIsLocalhost(const grpc::string& addr) {
}
// namespace
}
// namespace
class
Proxy
:
public
::
grpc
::
cpp
::
test
::
util
::
TestService
::
Service
{
public:
Proxy
(
std
::
shared_ptr
<
ChannelInterface
>
channel
)
:
stub_
(
grpc
::
cpp
::
test
::
util
::
TestService
::
NewStub
(
channel
))
{}
Status
Echo
(
ServerContext
*
server_context
,
const
EchoRequest
*
request
,
EchoResponse
*
response
)
GRPC_OVERRIDE
{
std
::
unique_ptr
<
ClientContext
>
client_context
=
ClientContext
::
FromServerContext
(
*
server_context
);
return
stub_
->
Echo
(
client_context
.
get
(),
*
request
,
response
);
}
private
:
std
::
unique_ptr
<::
grpc
::
cpp
::
test
::
util
::
TestService
::
Stub
>
stub_
;
};
class
TestServiceImpl
:
public
::
grpc
::
cpp
::
test
::
util
::
TestService
::
Service
{
class
TestServiceImpl
:
public
::
grpc
::
cpp
::
test
::
util
::
TestService
::
Service
{
public:
public:
TestServiceImpl
()
:
signal_client_
(
false
),
host_
()
{}
TestServiceImpl
()
:
signal_client_
(
false
),
host_
()
{}
...
@@ -241,7 +257,9 @@ class TestServiceImplDupPkg
...
@@ -241,7 +257,9 @@ class TestServiceImplDupPkg
}
}
};
};
class
End2endTest
:
public
::
testing
::
Test
{
/* Param is whether or not to use a proxy -- some tests use TEST_F as they don't
need this functionality */
class
End2endTest
:
public
::
testing
::
TestWithParam
<
bool
>
{
protected:
protected:
End2endTest
()
End2endTest
()
:
kMaxMessageSize_
(
8192
),
special_service_
(
"special"
),
thread_pool_
(
2
)
{}
:
kMaxMessageSize_
(
8192
),
special_service_
(
"special"
),
thread_pool_
(
2
)
{}
...
@@ -267,21 +285,41 @@ class End2endTest : public ::testing::Test {
...
@@ -267,21 +285,41 @@ class End2endTest : public ::testing::Test {
server_
=
builder
.
BuildAndStart
();
server_
=
builder
.
BuildAndStart
();
}
}
void
TearDown
()
GRPC_OVERRIDE
{
server_
->
Shutdown
();
}
void
TearDown
()
GRPC_OVERRIDE
{
server_
->
Shutdown
();
if
(
proxy_server_
)
proxy_server_
->
Shutdown
();
}
void
ResetStub
()
{
void
ResetStub
(
bool
use_proxy
)
{
SslCredentialsOptions
ssl_opts
=
{
test_root_cert
,
""
,
""
};
SslCredentialsOptions
ssl_opts
=
{
test_root_cert
,
""
,
""
};
ChannelArguments
args
;
ChannelArguments
args
;
args
.
SetSslTargetNameOverride
(
"foo.test.google.fr"
);
args
.
SetSslTargetNameOverride
(
"foo.test.google.fr"
);
args
.
SetString
(
GRPC_ARG_SECONDARY_USER_AGENT_STRING
,
"end2end_test"
);
args
.
SetString
(
GRPC_ARG_SECONDARY_USER_AGENT_STRING
,
"end2end_test"
);
channel_
=
CreateChannel
(
server_address_
.
str
(),
SslCredentials
(
ssl_opts
),
channel_
=
CreateChannel
(
server_address_
.
str
(),
SslCredentials
(
ssl_opts
),
args
);
args
);
if
(
use_proxy
)
{
proxy_service_
.
reset
(
new
Proxy
(
channel_
));
int
port
=
grpc_pick_unused_port_or_die
();
std
::
ostringstream
proxyaddr
;
proxyaddr
<<
"localhost:"
<<
port
;
ServerBuilder
builder
;
builder
.
AddListeningPort
(
proxyaddr
.
str
(),
InsecureServerCredentials
());
builder
.
RegisterService
(
proxy_service_
.
get
());
builder
.
SetThreadPool
(
&
thread_pool_
);
proxy_server_
=
builder
.
BuildAndStart
();
channel_
=
CreateChannel
(
proxyaddr
.
str
(),
InsecureCredentials
(),
ChannelArguments
());
}
stub_
=
std
::
move
(
grpc
::
cpp
::
test
::
util
::
TestService
::
NewStub
(
channel_
));
stub_
=
std
::
move
(
grpc
::
cpp
::
test
::
util
::
TestService
::
NewStub
(
channel_
));
}
}
std
::
shared_ptr
<
ChannelInterface
>
channel_
;
std
::
shared_ptr
<
ChannelInterface
>
channel_
;
std
::
unique_ptr
<
grpc
::
cpp
::
test
::
util
::
TestService
::
Stub
>
stub_
;
std
::
unique_ptr
<
grpc
::
cpp
::
test
::
util
::
TestService
::
Stub
>
stub_
;
std
::
unique_ptr
<
Server
>
server_
;
std
::
unique_ptr
<
Server
>
server_
;
std
::
unique_ptr
<
Server
>
proxy_server_
;
std
::
unique_ptr
<
Proxy
>
proxy_service_
;
std
::
ostringstream
server_address_
;
std
::
ostringstream
server_address_
;
const
int
kMaxMessageSize_
;
const
int
kMaxMessageSize_
;
TestServiceImpl
service_
;
TestServiceImpl
service_
;
...
@@ -306,7 +344,7 @@ static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
...
@@ -306,7 +344,7 @@ static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
}
}
TEST_F
(
End2endTest
,
SimpleRpcWithHost
)
{
TEST_F
(
End2endTest
,
SimpleRpcWithHost
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
...
@@ -321,13 +359,13 @@ TEST_F(End2endTest, SimpleRpcWithHost) {
...
@@ -321,13 +359,13 @@ TEST_F(End2endTest, SimpleRpcWithHost) {
EXPECT_TRUE
(
s
.
ok
());
EXPECT_TRUE
(
s
.
ok
());
}
}
TEST_
F
(
End2endTest
,
SimpleRpc
)
{
TEST_
P
(
End2endTest
,
SimpleRpc
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
SendRpc
(
stub_
.
get
(),
1
);
SendRpc
(
stub_
.
get
(),
1
);
}
}
TEST_
F
(
End2endTest
,
MultipleRpcs
)
{
TEST_
P
(
End2endTest
,
MultipleRpcs
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
std
::
vector
<
std
::
thread
*>
threads
;
std
::
vector
<
std
::
thread
*>
threads
;
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
threads
.
push_back
(
new
std
::
thread
(
SendRpc
,
stub_
.
get
(),
10
));
threads
.
push_back
(
new
std
::
thread
(
SendRpc
,
stub_
.
get
(),
10
));
...
@@ -339,8 +377,8 @@ TEST_F(End2endTest, MultipleRpcs) {
...
@@ -339,8 +377,8 @@ TEST_F(End2endTest, MultipleRpcs) {
}
}
// Set a 10us deadline and make sure proper error is returned.
// Set a 10us deadline and make sure proper error is returned.
TEST_
F
(
End2endTest
,
RpcDeadlineExpires
)
{
TEST_
P
(
End2endTest
,
RpcDeadlineExpires
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -354,8 +392,8 @@ TEST_F(End2endTest, RpcDeadlineExpires) {
...
@@ -354,8 +392,8 @@ TEST_F(End2endTest, RpcDeadlineExpires) {
}
}
// Set a long but finite deadline.
// Set a long but finite deadline.
TEST_
F
(
End2endTest
,
RpcLongDeadline
)
{
TEST_
P
(
End2endTest
,
RpcLongDeadline
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -370,8 +408,8 @@ TEST_F(End2endTest, RpcLongDeadline) {
...
@@ -370,8 +408,8 @@ TEST_F(End2endTest, RpcLongDeadline) {
}
}
// Ask server to echo back the deadline it sees.
// Ask server to echo back the deadline it sees.
TEST_
F
(
End2endTest
,
EchoDeadline
)
{
TEST_
P
(
End2endTest
,
EchoDeadline
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -392,8 +430,8 @@ TEST_F(End2endTest, EchoDeadline) {
...
@@ -392,8 +430,8 @@ TEST_F(End2endTest, EchoDeadline) {
}
}
// Ask server to echo back the deadline it sees. The rpc has no deadline.
// Ask server to echo back the deadline it sees. The rpc has no deadline.
TEST_
F
(
End2endTest
,
EchoDeadlineForNoDeadlineRpc
)
{
TEST_
P
(
End2endTest
,
EchoDeadlineForNoDeadlineRpc
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -407,8 +445,8 @@ TEST_F(End2endTest, EchoDeadlineForNoDeadlineRpc) {
...
@@ -407,8 +445,8 @@ TEST_F(End2endTest, EchoDeadlineForNoDeadlineRpc) {
gpr_inf_future
(
GPR_CLOCK_REALTIME
).
tv_sec
);
gpr_inf_future
(
GPR_CLOCK_REALTIME
).
tv_sec
);
}
}
TEST_
F
(
End2endTest
,
UnimplementedRpc
)
{
TEST_
P
(
End2endTest
,
UnimplementedRpc
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -422,7 +460,7 @@ TEST_F(End2endTest, UnimplementedRpc) {
...
@@ -422,7 +460,7 @@ TEST_F(End2endTest, UnimplementedRpc) {
}
}
TEST_F
(
End2endTest
,
RequestStreamOneRequest
)
{
TEST_F
(
End2endTest
,
RequestStreamOneRequest
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -437,7 +475,7 @@ TEST_F(End2endTest, RequestStreamOneRequest) {
...
@@ -437,7 +475,7 @@ TEST_F(End2endTest, RequestStreamOneRequest) {
}
}
TEST_F
(
End2endTest
,
RequestStreamTwoRequests
)
{
TEST_F
(
End2endTest
,
RequestStreamTwoRequests
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -453,7 +491,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
...
@@ -453,7 +491,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) {
}
}
TEST_F
(
End2endTest
,
ResponseStream
)
{
TEST_F
(
End2endTest
,
ResponseStream
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -473,7 +511,7 @@ TEST_F(End2endTest, ResponseStream) {
...
@@ -473,7 +511,7 @@ TEST_F(End2endTest, ResponseStream) {
}
}
TEST_F
(
End2endTest
,
BidiStream
)
{
TEST_F
(
End2endTest
,
BidiStream
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -506,7 +544,7 @@ TEST_F(End2endTest, BidiStream) {
...
@@ -506,7 +544,7 @@ TEST_F(End2endTest, BidiStream) {
// Talk to the two services with the same name but different package names.
// Talk to the two services with the same name but different package names.
// The two stubs are created on the same channel.
// The two stubs are created on the same channel.
TEST_F
(
End2endTest
,
DiffPackageServices
)
{
TEST_F
(
End2endTest
,
DiffPackageServices
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -561,8 +599,8 @@ void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) {
...
@@ -561,8 +599,8 @@ void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) {
}
}
// Client cancels rpc after 10ms
// Client cancels rpc after 10ms
TEST_
F
(
End2endTest
,
ClientCancelsRpc
)
{
TEST_
P
(
End2endTest
,
ClientCancelsRpc
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -578,8 +616,8 @@ TEST_F(End2endTest, ClientCancelsRpc) {
...
@@ -578,8 +616,8 @@ TEST_F(End2endTest, ClientCancelsRpc) {
}
}
// Server cancels rpc after 1ms
// Server cancels rpc after 1ms
TEST_
F
(
End2endTest
,
ServerCancelsRpc
)
{
TEST_
P
(
End2endTest
,
ServerCancelsRpc
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -593,7 +631,7 @@ TEST_F(End2endTest, ServerCancelsRpc) {
...
@@ -593,7 +631,7 @@ TEST_F(End2endTest, ServerCancelsRpc) {
// Client cancels request stream after sending two messages
// Client cancels request stream after sending two messages
TEST_F
(
End2endTest
,
ClientCancelsRequestStream
)
{
TEST_F
(
End2endTest
,
ClientCancelsRequestStream
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -613,7 +651,7 @@ TEST_F(End2endTest, ClientCancelsRequestStream) {
...
@@ -613,7 +651,7 @@ TEST_F(End2endTest, ClientCancelsRequestStream) {
// Client cancels server stream after sending some messages
// Client cancels server stream after sending some messages
TEST_F
(
End2endTest
,
ClientCancelsResponseStream
)
{
TEST_F
(
End2endTest
,
ClientCancelsResponseStream
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -645,7 +683,7 @@ TEST_F(End2endTest, ClientCancelsResponseStream) {
...
@@ -645,7 +683,7 @@ TEST_F(End2endTest, ClientCancelsResponseStream) {
// Client cancels bidi stream after sending some messages
// Client cancels bidi stream after sending some messages
TEST_F
(
End2endTest
,
ClientCancelsBidi
)
{
TEST_F
(
End2endTest
,
ClientCancelsBidi
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -677,7 +715,7 @@ TEST_F(End2endTest, ClientCancelsBidi) {
...
@@ -677,7 +715,7 @@ TEST_F(End2endTest, ClientCancelsBidi) {
}
}
TEST_F
(
End2endTest
,
RpcMaxMessageSize
)
{
TEST_F
(
End2endTest
,
RpcMaxMessageSize
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
string
(
kMaxMessageSize_
*
2
,
'a'
));
request
.
set_message
(
string
(
kMaxMessageSize_
*
2
,
'a'
));
...
@@ -702,7 +740,7 @@ bool MetadataContains(const std::multimap<grpc::string, grpc::string>& metadata,
...
@@ -702,7 +740,7 @@ bool MetadataContains(const std::multimap<grpc::string, grpc::string>& metadata,
}
}
TEST_F
(
End2endTest
,
SetPerCallCredentials
)
{
TEST_F
(
End2endTest
,
SetPerCallCredentials
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -724,7 +762,7 @@ TEST_F(End2endTest, SetPerCallCredentials) {
...
@@ -724,7 +762,7 @@ TEST_F(End2endTest, SetPerCallCredentials) {
}
}
TEST_F
(
End2endTest
,
InsecurePerCallCredentials
)
{
TEST_F
(
End2endTest
,
InsecurePerCallCredentials
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -739,7 +777,7 @@ TEST_F(End2endTest, InsecurePerCallCredentials) {
...
@@ -739,7 +777,7 @@ TEST_F(End2endTest, InsecurePerCallCredentials) {
}
}
TEST_F
(
End2endTest
,
OverridePerCallCredentials
)
{
TEST_F
(
End2endTest
,
OverridePerCallCredentials
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -772,7 +810,7 @@ TEST_F(End2endTest, OverridePerCallCredentials) {
...
@@ -772,7 +810,7 @@ TEST_F(End2endTest, OverridePerCallCredentials) {
// Client sends 20 requests and the server returns CANCELLED status after
// Client sends 20 requests and the server returns CANCELLED status after
// reading 10 requests.
// reading 10 requests.
TEST_F
(
End2endTest
,
RequestStreamServerEarlyCancelTest
)
{
TEST_F
(
End2endTest
,
RequestStreamServerEarlyCancelTest
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
ClientContext
context
;
ClientContext
context
;
...
@@ -791,7 +829,7 @@ TEST_F(End2endTest, RequestStreamServerEarlyCancelTest) {
...
@@ -791,7 +829,7 @@ TEST_F(End2endTest, RequestStreamServerEarlyCancelTest) {
}
}
TEST_F
(
End2endTest
,
ClientAuthContext
)
{
TEST_F
(
End2endTest
,
ClientAuthContext
)
{
ResetStub
();
ResetStub
(
false
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"Hello"
);
request
.
set_message
(
"Hello"
);
...
@@ -816,8 +854,8 @@ TEST_F(End2endTest, ClientAuthContext) {
...
@@ -816,8 +854,8 @@ TEST_F(End2endTest, ClientAuthContext) {
}
}
// Make the response larger than the flow control window.
// Make the response larger than the flow control window.
TEST_
F
(
End2endTest
,
HugeResponse
)
{
TEST_
P
(
End2endTest
,
HugeResponse
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"huge response"
);
request
.
set_message
(
"huge response"
);
...
@@ -842,7 +880,7 @@ void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream, gpr
...
@@ -842,7 +880,7 @@ void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream, gpr
// Run a Read and a WritesDone simultaneously.
// Run a Read and a WritesDone simultaneously.
TEST_F
(
End2endTest
,
SimultaneousReadWritesDone
)
{
TEST_F
(
End2endTest
,
SimultaneousReadWritesDone
)
{
ResetStub
();
ResetStub
(
false
);
ClientContext
context
;
ClientContext
context
;
gpr_event
ev
;
gpr_event
ev
;
gpr_event_init
(
&
ev
);
gpr_event_init
(
&
ev
);
...
@@ -855,8 +893,8 @@ TEST_F(End2endTest, SimultaneousReadWritesDone) {
...
@@ -855,8 +893,8 @@ TEST_F(End2endTest, SimultaneousReadWritesDone) {
reader_thread
.
join
();
reader_thread
.
join
();
}
}
TEST_
F
(
End2endTest
,
Peer
)
{
TEST_
P
(
End2endTest
,
Peer
)
{
ResetStub
();
ResetStub
(
GetParam
()
);
EchoRequest
request
;
EchoRequest
request
;
EchoResponse
response
;
EchoResponse
response
;
request
.
set_message
(
"hello"
);
request
.
set_message
(
"hello"
);
...
@@ -870,6 +908,8 @@ TEST_F(End2endTest, Peer) {
...
@@ -870,6 +908,8 @@ TEST_F(End2endTest, Peer) {
EXPECT_TRUE
(
CheckIsLocalhost
(
context
.
peer
()));
EXPECT_TRUE
(
CheckIsLocalhost
(
context
.
peer
()));
}
}
INSTANTIATE_TEST_CASE_P
(
End2end
,
End2endTest
,
::
testing
::
Values
(
false
,
true
));
}
// namespace testing
}
// namespace testing
}
// namespace grpc
}
// namespace grpc
...
...
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