diff --git a/source/extensions/retry/priority/other_priority/config.h b/source/extensions/retry/priority/other_priority/config.h index 770ad8afa4580..ece9c89b055a7 100644 --- a/source/extensions/retry/priority/other_priority/config.h +++ b/source/extensions/retry/priority/other_priority/config.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/config/retry/other_priority/other_priority_config.pb.validate.h" #include "envoy/upstream/retry.h" #include "common/protobuf/protobuf.h" @@ -22,7 +23,8 @@ class OtherPriorityRetryPriorityFactory : public Upstream::RetryPriorityFactory } ProtobufTypes::MessagePtr createEmptyConfigProto() override { - return ProtobufTypes::MessagePtr(new ::Envoy::ProtobufWkt::Empty()); + return ProtobufTypes::MessagePtr( + new envoy::config::retry::other_priority::OtherPriorityConfig()); } }; diff --git a/test/extensions/retry/priority/other_priority/config_test.cc b/test/extensions/retry/priority/other_priority/config_test.cc index b35a2a05d3230..bc283390d9f4b 100644 --- a/test/extensions/retry/priority/other_priority/config_test.cc +++ b/test/extensions/retry/priority/other_priority/config_test.cc @@ -25,7 +25,11 @@ class RetryPriorityTest : public ::testing::Test, Upstream::RetryPriorityFactory envoy::config::retry::other_priority::OtherPriorityConfig config; config.set_update_frequency(update_frequency_); - factory->createRetryPriority(*this, config, 3); + // Use createEmptyConfigProto to exercise that code path. This ensures the proto returned + // by that method is compatible with the downcast in createRetryPriority. + auto empty = factory->createEmptyConfigProto(); + empty->MergeFrom(config); + factory->createRetryPriority(*this, *empty, 3); } // Upstream::RetryPriorityFactoryCallbacks