Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
w-gc committed Jan 24, 2025
1 parent 634f0e3 commit 4983198
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/brpc_channel_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ class ChannelTest : public ::testing::Test{
ChannelTest()
: _ep(butil::IP_ANY, 8787)
, _close_fd_once(false) {
if (!_dummy.options().rpc_pb_message_factory) {
_dummy._options.rpc_pb_message_factory = new brpc::DefaultRpcPBMessageFactory();
}

pthread_once(&register_mock_protocol, register_protocol);
const brpc::InputMessageHandler pairs[] = {
{ brpc::policy::ParseRpcMessage,
Expand Down Expand Up @@ -256,11 +260,6 @@ class ChannelTest : public ::testing::Test{
ASSERT_EQ(ts->_svc.descriptor()->full_name(), req_meta.service_name());
const google::protobuf::MethodDescriptor* method =
ts->_svc.descriptor()->FindMethodByName(req_meta.method_name());

if (!ts->_dummy.options().rpc_pb_message_factory) {
ts->_dummy._options.rpc_pb_message_factory = new brpc::DefaultRpcPBMessageFactory();
}

brpc::RpcPBMessages* messages =
ts->_dummy.options().rpc_pb_message_factory->Get(ts->_svc, *method);
google::protobuf::Message* req = messages->Request();
Expand Down

0 comments on commit 4983198

Please sign in to comment.