From c838106d8f9da0707838c738fd24ba3266c46bcd Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 26 Mar 2024 20:14:33 +0000 Subject: [PATCH] fix tests Change-Id: I835d26ec21a843fb4905413768a457bef3aca3a6 Signed-off-by: Kuat Yessenov --- .../path/uri_template_lib/uri_template_test.cc | 13 ++++++++++++- test/server/hot_restarting_child_test.cc | 8 +++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/extensions/path/uri_template_lib/uri_template_test.cc b/test/extensions/path/uri_template_lib/uri_template_test.cc index 14d44b2b8603..018371945f4d 100644 --- a/test/extensions/path/uri_template_lib/uri_template_test.cc +++ b/test/extensions/path/uri_template_lib/uri_template_test.cc @@ -13,10 +13,21 @@ #include "gtest/gtest.h" +// NOLINT(namespace-envoy) +// Overload functions in std library. +namespace std { + +std::ostream& operator<<(std::ostream& os, + const Envoy::Extensions::UriTemplate::RewriteSegment& seg) { + absl::visit([&os](auto&& arg) { os << arg; }, seg); + return os; +} + +} // namespace std + namespace Envoy { namespace Extensions { namespace UriTemplate { - namespace { using ::Envoy::StatusHelpers::IsOkAndHolds; diff --git a/test/server/hot_restarting_child_test.cc b/test/server/hot_restarting_child_test.cc index d16653d6454a..1e42b39ae17f 100644 --- a/test/server/hot_restarting_child_test.cc +++ b/test/server/hot_restarting_child_test.cc @@ -228,9 +228,11 @@ TEST_F(HotRestartingChildTest, ForwardsPacketToRegisteredListenerOnMatch) { packet->set_payload(udp_contents); packet->set_receive_time_epoch_microseconds(packet_timestamp); Network::MockUdpListenerWorkerRouter mock_worker_router; - EXPECT_CALL(*mock_udp_listener_config, - listenerWorkerRouter(WhenDynamicCastTo( - Eq(dynamic_cast(*test_listener_addr))))) + EXPECT_CALL(*mock_udp_listener_config, listenerWorkerRouter(testing::ResultOf( + [](const Network::Address::Instance& instance) { + return instance.asStringView(); + }, + Eq(test_listener_addr->asStringView())))) .WillOnce(ReturnRef(mock_worker_router)); EXPECT_CALL(mock_worker_router, deliver(worker_index, IsUdpWith(test_listener_addr, test_remote_addr, udp_contents,