Skip to content

Commit

Permalink
itest ut
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Jan 2, 2024
1 parent cd349b0 commit 7e30701
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion interface/common/resdb_state_accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ ResDBStateAccessor::GetReplicaStates() {
std::unique_ptr<NetChannel> client =
GetNetChannel(client_info.ip(), client_info.port());
client->SetRecvTimeout(1000000); // 1s for recv timeout.


LOG(ERROR)<<"send request";
int ret = client->SendRequest(request, Request::TYPE_REPLICA_STATE);
if (ret) {
return absl::InternalError("send data fail.");
}

std::unique_ptr<ReplicaState> state = std::make_unique<ReplicaState>();
LOG(ERROR)<<"recv request";
ret = client->RecvRawMessage(state.get());
if (ret < 0) {
return absl::InternalError("recv data fail.");
Expand Down
2 changes: 2 additions & 0 deletions interface/common/resdb_state_accessor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ TEST_F(StateClientTest, GetAllReplicaState) {
}));
auto ret = client.GetReplicaStates();
EXPECT_TRUE(ret.ok());
LOG(ERROR)<<"get ok";
std::set<int> results;
for (auto& state : *ret) {
auto it = std::find_if(
Expand All @@ -107,6 +108,7 @@ TEST_F(StateClientTest, GetAllReplicaState) {
EXPECT_TRUE(it != replicas_.end());
results.insert(it - replicas_.begin());
}
LOG(ERROR)<<"get result ok";
EXPECT_EQ(results.size(), 4);
}

Expand Down

0 comments on commit 7e30701

Please sign in to comment.