From 771427c05088f579f55317342b1b5732c3fb9ef6 Mon Sep 17 00:00:00 2001 From: jcaiMR Date: Mon, 4 Sep 2023 12:02:44 +0000 Subject: [PATCH] improve ut coverage --- test/mock_relay.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/mock_relay.cpp b/test/mock_relay.cpp index 6383ed3..0a06ce5 100644 --- a/test/mock_relay.cpp +++ b/test/mock_relay.cpp @@ -1179,7 +1179,9 @@ TEST(relay, update_portchannel_mapping) { std::string *output; const std::unique_ptr 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(); @@ -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(); @@ -1260,6 +1264,3 @@ TEST(relay, packet_counting_handler) { - - -