Skip to content

Commit

Permalink
improve ut coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaiMR committed Sep 4, 2023
1 parent 6c2ac1e commit 771427c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/mock_relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,9 @@ TEST(relay, update_portchannel_mapping) {
std::string *output;
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());

output = state_db->hget("DHCPv6_COUNTER_TABLE|PortChannel101", "RX").get();
auto output_ptr1 = state_db->hget("DHCPv6_COUNTER_TABLE|PortChannel101", "RX");
EXPECT_NE(output_ptr1, nullptr);
output = output_ptr1.get();
std::replace(output->begin(), output->end(), '\'', '\"');
auto json_begin = output->c_str();
auto json_end = json_begin + output->length();
Expand All @@ -1190,7 +1192,9 @@ TEST(relay, update_portchannel_mapping) {
EXPECT_EQ(root["Advertise"], "0");
EXPECT_EQ(root["Malformed"], "0");

output = state_db->hget("DHCPv6_COUNTER_TABLE|Ethernet52", "TX").get();
auto output_ptr2 = state_db->hget("DHCPv6_COUNTER_TABLE|Ethernet52", "TX");
EXPECT_NE(output_ptr2, nullptr);
output = output_ptr2.get();
std::replace(output->begin(), output->end(), '\'', '\"');
json_begin = output->c_str();
json_end = json_begin + output->length();
Expand Down Expand Up @@ -1260,6 +1264,3 @@ TEST(relay, packet_counting_handler) {






0 comments on commit 771427c

Please sign in to comment.