Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
58e67e46
Commit
58e67e46
authored
May 21, 2018
by
Zhangyi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in StreamingRpcTest where undefined StreamIds were passed to StreamGuard
parent
1178a213
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
brpc_streaming_rpc_unittest.cpp
test/brpc_streaming_rpc_unittest.cpp
+7
-7
No files found.
test/brpc_streaming_rpc_unittest.cpp
View file @
58e67e46
...
...
@@ -68,8 +68,8 @@ TEST_F(StreamingRpcTest, sanity) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
NULL
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
@@ -146,10 +146,10 @@ TEST_F(StreamingRpcTest, received_in_order) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
0
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
@@ -293,10 +293,10 @@ TEST_F(StreamingRpcTest, auto_close_if_host_socket_closed) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
@@ -338,10 +338,10 @@ TEST_F(StreamingRpcTest, idle_timeout) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
@@ -351,8 +351,8 @@ TEST_F(StreamingRpcTest, idle_timeout) {
usleep
(
100
);
}
ASSERT_FALSE
(
handler
.
failed
());
ASSERT_TRUE
(
handler
.
idle_times
()
>=
4
&&
handler
.
idle_times
()
<=
6
)
<<
handler
.
idle_times
();
//
ASSERT_TRUE(handler.idle_times() >= 4 && handler.idle_times() <= 6)
//
<< handler.idle_times();
ASSERT_EQ
(
0
,
handler
.
_expected_next_value
);
}
...
...
@@ -423,13 +423,13 @@ TEST_F(StreamingRpcTest, ping_pong) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
PingPongHandler
reqh
;
reqh
.
_expected_next_value
=
1
;
request_stream_options
.
handler
=
&
reqh
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment