diff --git a/source/common/upstream/cluster_factory_impl.cc b/source/common/upstream/cluster_factory_impl.cc index 48c8779608a2..0cb89487aca2 100644 --- a/source/common/upstream/cluster_factory_impl.cc +++ b/source/common/upstream/cluster_factory_impl.cc @@ -115,10 +115,12 @@ ClusterFactoryImplBase::create(const envoy::config::cluster::v3::Cluster& cluste } } - new_cluster_pair.first->setOutlierDetector(Outlier::DetectorImplFactory::createForCluster( + auto detector_or_error = Outlier::DetectorImplFactory::createForCluster( *new_cluster_pair.first, cluster, server_context.mainThreadDispatcher(), server_context.runtime(), context.outlierEventLogger(), - server_context.api().randomGenerator())); + server_context.api().randomGenerator()); + RETURN_IF_STATUS_NOT_OK(detector_or_error); + new_cluster_pair.first->setOutlierDetector(detector_or_error.value()); return status_or_cluster; } diff --git a/source/common/upstream/outlier_detection_impl.cc b/source/common/upstream/outlier_detection_impl.cc index d74d42b83a99..79a9e304e699 100644 --- a/source/common/upstream/outlier_detection_impl.cc +++ b/source/common/upstream/outlier_detection_impl.cc @@ -23,7 +23,7 @@ namespace Envoy { namespace Upstream { namespace Outlier { -DetectorSharedPtr DetectorImplFactory::createForCluster( +absl::StatusOr DetectorImplFactory::createForCluster( Cluster& cluster, const envoy::config::cluster::v3::Cluster& cluster_config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, EventLoggerSharedPtr event_logger, Random::RandomGenerator& random) { @@ -284,7 +284,7 @@ DetectorImpl::~DetectorImpl() { } } -std::shared_ptr +absl::StatusOr> DetectorImpl::create(Cluster& cluster, const envoy::config::cluster::v3::OutlierDetection& config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, TimeSource& time_source, EventLoggerSharedPtr event_logger, @@ -293,7 +293,7 @@ DetectorImpl::create(Cluster& cluster, const envoy::config::cluster::v3::Outlier new DetectorImpl(cluster, config, dispatcher, runtime, time_source, event_logger, random)); if (detector->config().maxEjectionTimeMs() < detector->config().baseEjectionTimeMs()) { - throwEnvoyExceptionOrPanic( + return absl::InvalidArgumentError( "outlier detector's max_ejection_time cannot be smaller than base_ejection_time"); } detector->initialize(cluster); diff --git a/source/common/upstream/outlier_detection_impl.h b/source/common/upstream/outlier_detection_impl.h index 4044cd0d1ecf..1a70d3c75129 100644 --- a/source/common/upstream/outlier_detection_impl.h +++ b/source/common/upstream/outlier_detection_impl.h @@ -34,7 +34,7 @@ namespace Outlier { */ class DetectorImplFactory { public: - static DetectorSharedPtr + static absl::StatusOr createForCluster(Cluster& cluster, const envoy::config::cluster::v3::Cluster& cluster_config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, EventLoggerSharedPtr event_logger, Random::RandomGenerator& random); @@ -372,7 +372,7 @@ class DetectorConfig { */ class DetectorImpl : public Detector, public std::enable_shared_from_this { public: - static std::shared_ptr + static absl::StatusOr> create(Cluster& cluster, const envoy::config::cluster::v3::OutlierDetection& config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, TimeSource& time_source, EventLoggerSharedPtr event_logger, Random::RandomGenerator& random); diff --git a/test/common/upstream/outlier_detection_impl_test.cc b/test/common/upstream/outlier_detection_impl_test.cc index a44c14fe557c..2feaf7303dda 100644 --- a/test/common/upstream/outlier_detection_impl_test.cc +++ b/test/common/upstream/outlier_detection_impl_test.cc @@ -47,7 +47,8 @@ TEST(OutlierDetectorImplFactoryTest, NoDetector) { NiceMock random; EXPECT_EQ(nullptr, DetectorImplFactory::createForCluster(cluster, defaultStaticCluster("fake_cluster"), - dispatcher, runtime, nullptr, random)); + dispatcher, runtime, nullptr, random) + .value()); } TEST(OutlierDetectorImplFactoryTest, Detector) { @@ -59,7 +60,8 @@ TEST(OutlierDetectorImplFactoryTest, Detector) { NiceMock runtime; NiceMock random; EXPECT_NE(nullptr, DetectorImplFactory::createForCluster(cluster, fake_cluster, dispatcher, - runtime, nullptr, random)); + runtime, nullptr, random) + .value()); } class CallbackChecker { @@ -146,8 +148,10 @@ max_ejection_time: 400s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); EXPECT_EQ(100UL, detector->config().intervalMs()); EXPECT_EQ(10000UL, detector->config().baseEjectionTimeMs()); @@ -179,8 +183,10 @@ base_ejection_time: 10s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); EXPECT_EQ(100UL, detector->config().intervalMs()); EXPECT_EQ(10000UL, detector->config().baseEjectionTimeMs()); @@ -209,9 +215,10 @@ max_ejection_time: 3s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); // Detector should reject the config. - ASSERT_THROW(DetectorImpl::create(cluster_, outlier_detection, dispatcher_, runtime_, - time_system_, event_logger_, random_), - EnvoyException); + ASSERT_FALSE(DetectorImpl::create(cluster_, outlier_detection, dispatcher_, runtime_, + time_system_, event_logger_, random_) + .status() + .ok()); } // Test verifies that legacy config without max_ejection_time value @@ -226,8 +233,10 @@ base_ejection_time: 400s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); EXPECT_EQ(100UL, detector->config().intervalMs()); EXPECT_EQ(400000UL, detector->config().baseEjectionTimeMs()); @@ -242,7 +251,8 @@ TEST_F(OutlierDetectorImplTest, DestroyWithActive) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 500); @@ -274,7 +284,8 @@ TEST_F(OutlierDetectorImplTest, DestroyHostInUse) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); detector.reset(); @@ -293,7 +304,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xxViaHttpCodes) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); addHosts({"tcp://127.0.0.1:81"}); @@ -370,7 +382,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xxViaHttpCodesWithActiveHCUnejectHost) std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); addHosts({"tcp://127.0.0.1:81"}); @@ -476,8 +489,10 @@ successful_active_health_check_uneject_host: false EXPECT_CALL(*health_checker, addHostCheckCompleteCb(_)).Times(0); ON_CALL(cluster_, healthChecker()).WillByDefault(Return(health_checker.get())); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); addHosts({"tcp://127.0.0.1:81"}); @@ -534,7 +549,8 @@ TEST_F(OutlierDetectorImplTest, ConnectSuccessWithOptionalHTTP_OK) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Make sure that in non-split mode LOCAL_ORIGIN_CONNECT_SUCCESS with optional HTTP code 200 @@ -561,7 +577,8 @@ TEST_F(OutlierDetectorImplTest, ExternalOriginEventsNonSplit) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Make sure that EXT_ORIGIN_REQUEST_SUCCESS cancels EXT_ORIGIN_REQUEST_FAILED @@ -589,7 +606,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xxViaNonHttpCodes) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); addHosts({"tcp://127.0.0.1:81"}); @@ -668,7 +686,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowGatewayFailure) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); ON_CALL(runtime_.snapshot_, featureEnabled(EnforcingConsecutiveGatewayFailureRuntime, 0)) .WillByDefault(Return(true)); @@ -766,7 +785,8 @@ TEST_F(OutlierDetectorImplTest, TimeoutWithHttpCode) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Report several LOCAL_ORIGIN_TIMEOUT with optional Http code 500. Host should be ejected. @@ -839,7 +859,8 @@ TEST_F(OutlierDetectorImplTest, LargeNumberOfTimeouts) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_split_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); ON_CALL(runtime_.snapshot_, featureEnabled(EnforcingConsecutiveLocalOriginFailureRuntime, 100)) .WillByDefault(Return(true)); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); @@ -894,7 +915,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowLocalOriginFailure) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_split_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); ON_CALL(runtime_.snapshot_, featureEnabled(EnforcingConsecutiveLocalOriginFailureRuntime, 100)) .WillByDefault(Return(true)); @@ -1009,7 +1031,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowGatewayFailureAnd5xx) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); ON_CALL(runtime_.snapshot_, featureEnabled(EnforcingConsecutiveGatewayFailureRuntime, 0)) .WillByDefault(Return(true)); @@ -1099,7 +1122,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowNonHttpCodesExternalOrigin) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); addHosts({"tcp://127.0.0.1:81"}); @@ -1152,7 +1176,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowSuccessRateExternalOrigin) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Turn off 5xx detection to test SR detection in isolation. @@ -1252,7 +1277,8 @@ TEST_F(OutlierDetectorImplTest, ExternalOriginEventsWithSplit) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_split_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); for (auto i = 0; i < 100; i++) { hosts_[0]->outlierDetector().putResult(Result::ExtOriginRequestFailed); @@ -1286,7 +1312,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowSuccessRateLocalOrigin) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_split_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Turn off detecting consecutive local origin failures. @@ -1375,7 +1402,8 @@ TEST_F(OutlierDetectorImplTest, EmptySuccessRate) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); loadRq(hosts_, 200, 503); time_system_.setMonotonicTime(std::chrono::milliseconds(10000)); @@ -1399,7 +1427,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowFailurePercentageExternalOrigin) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Turn off 5xx detection and SR detection to test failure percentage detection in isolation. @@ -1520,7 +1549,8 @@ TEST_F(OutlierDetectorImplTest, BasicFlowFailurePercentageLocalOrigin) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_split_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Turn off 5xx detection and SR detection to test failure percentage detection in isolation. @@ -1619,7 +1649,8 @@ TEST_F(OutlierDetectorImplTest, RemoveWhileEjected) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 500); @@ -1649,7 +1680,8 @@ TEST_F(OutlierDetectorImplTest, Overflow) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); ON_CALL(runtime_.snapshot_, getInteger(MaxEjectionPercentRuntime, _)).WillByDefault(Return(60)); @@ -1678,7 +1710,8 @@ TEST_F(OutlierDetectorImplTest, NotEnforcing) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 503); @@ -1721,7 +1754,8 @@ TEST_F(OutlierDetectorImplTest, EjectionActiveValueIsAccountedWithoutMetricStora EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); ON_CALL(runtime_.snapshot_, getInteger(MaxEjectionPercentRuntime, _)).WillByDefault(Return(50)); @@ -1759,7 +1793,8 @@ TEST_F(OutlierDetectorImplTest, CrossThreadRemoveRace) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 500); @@ -1784,7 +1819,8 @@ TEST_F(OutlierDetectorImplTest, CrossThreadDestroyRace) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 500); @@ -1811,7 +1847,8 @@ TEST_F(OutlierDetectorImplTest, CrossThreadFailRace) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); loadRq(hosts_[0], 4, 500); @@ -1851,8 +1888,10 @@ max_ejection_time_jitter: 13s addHosts({"tcp://127.0.0.4:80"}); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection_, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); @@ -1882,8 +1921,10 @@ max_ejection_time_jitter: 13s addHosts({"tcp://127.0.0.2:80"}); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection_, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection_, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); loadRq(hosts_[0], 5, 500); EXPECT_FALSE(hosts_[0]->healthFlagGet(Host::HealthFlag::FAILED_OUTLIER_CHECK)); @@ -1896,7 +1937,8 @@ TEST_F(OutlierDetectorImplTest, Consecutive_5xxAlreadyEjected) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Cause a consecutive 5xx error. loadRq(hosts_[0], 4, 500); @@ -1934,7 +1976,8 @@ TEST_F(OutlierDetectorImplTest, EjectTimeBackoff) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Eject the node by consecutive 5xx errors. @@ -2099,7 +2142,8 @@ TEST_F(OutlierDetectorImplTest, EjectTimeBackoffTimeBasedDetection) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(base_ejection_time), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Turn off 5xx detection to test failure percentage in isolation. @@ -2259,7 +2303,8 @@ TEST_F(OutlierDetectorImplTest, MaxEjectTime) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Verify that maximum_ejection_time caps ejection time. @@ -2353,7 +2398,8 @@ TEST_F(OutlierDetectorImplTest, MaxEjectTimeNotAlligned) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Verify that maximum_ejection_time caps ejection time. @@ -2437,8 +2483,10 @@ max_ejection_time_jitter: 13s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); EXPECT_EQ(100UL, detector->config().intervalMs()); EXPECT_EQ(10000UL, detector->config().baseEjectionTimeMs()); @@ -2456,8 +2504,10 @@ base_ejection_time: 10s envoy::config::cluster::v3::OutlierDetection outlier_detection; TestUtility::loadFromYaml(yaml, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100), _)); - std::shared_ptr detector(DetectorImpl::create( - cluster_, outlier_detection, dispatcher_, runtime_, time_system_, event_logger_, random_)); + std::shared_ptr detector(DetectorImpl::create(cluster_, outlier_detection, + dispatcher_, runtime_, time_system_, + event_logger_, random_) + .value()); EXPECT_EQ(100UL, detector->config().intervalMs()); EXPECT_EQ(10000UL, detector->config().baseEjectionTimeMs()); @@ -2477,7 +2527,8 @@ TEST_F(OutlierDetectorImplTest, EjectionTimeJitterIsInRange) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Set the return value of random(). EXPECT_CALL(random_, random()).WillOnce(Return(123456789UL)); @@ -2507,7 +2558,8 @@ TEST_F(OutlierDetectorImplTest, EjectionTimeJitterIsZeroWhenNotConfigured) { EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000), _)); std::shared_ptr detector(DetectorImpl::create(cluster_, empty_outlier_detection_, dispatcher_, runtime_, time_system_, - event_logger_, random_)); + event_logger_, random_) + .value()); detector->addChangedStateCb([&](HostSharedPtr host) -> void { checker_.check(host); }); // Set the return value of random(). EXPECT_CALL(random_, random()).WillOnce(Return(1234567890UL)); diff --git a/tools/base/requirements.txt b/tools/base/requirements.txt index f9945610cf14..efecf2a968c0 100644 --- a/tools/base/requirements.txt +++ b/tools/base/requirements.txt @@ -173,30 +173,30 @@ aiohttp==3.9.1 \ # envoy-github-abstract # envoy-github-release # google-auth -aioquic==0.9.23 \ - --hash=sha256:1a06d91653fca2bc11ef58069fac921f162fc8f462ee2500ffbd789ff6768700 \ - --hash=sha256:1ce9f56ba54022b0953621232ed0775e91eff29c53f4a6fb0149abbff15f6c71 \ - --hash=sha256:1d86deaef3bf72581c165f54a74f4d70caaf5a442756f4b4c07c279cb734f69a \ - --hash=sha256:29e2df45378a02987c0c90ac888acc4080f762a593ccacb523cd9cd489555bb4 \ - --hash=sha256:3c4d41a9bce144b5f783cce578aa6de3e185917270d43a875f017f7a5173c381 \ - --hash=sha256:52c9da60ed0837fe8b8a6a0d7dcf0dfbebec8e9a027e10ebf7204f0569c58fa8 \ - --hash=sha256:54e1126813bf180801f2d192892383391e609b9748a43bf3c19d4a263577735c \ - --hash=sha256:5c7bfd0c4bd51c945a15d553e15c61a0b36a5aff286f92c151ff16be8839d964 \ - --hash=sha256:6483137e38c39bbcbbdd28c378e189fb4b2a689d6b5c700bdba5b15835c895b3 \ - --hash=sha256:72e1ff2291322f9bc4d29c3ccb91505af665246eca0df1dbf5a0dd00d2ccf6fa \ - --hash=sha256:7932510524559d2eb5412d26cecadde2c1df79c7da4e7ea8f0732e66e95d0231 \ - --hash=sha256:7bb5930f374bd3c7fad9bf8d823a0dcc51752c3b3e5dbf1b42f1804df49c4343 \ - --hash=sha256:8baa3c20b8a7619dd4fc4ddd45496da6a7940286a0d4f0aeb2e3eb6e8e171d2f \ - --hash=sha256:96f46bf96df95c46f1b779ebd7ac896672f2daff60cc9de60b3e4b329d6e26b2 \ - --hash=sha256:9a49e8534d30bcaca9d4c5ba042f662c0110fe798c3552e6a662946a8df9f569 \ - --hash=sha256:9be4d7562beabf7b4c6eb6366aaeea9615e9cc6b53411fad5cd9620629ca4b2a \ - --hash=sha256:a3adbb6363cf57c5a3e0a6afa9bfd5236840ffeb99b2cf4b4eb4acfd8b7459ca \ - --hash=sha256:b65559878bf44d4e62edb3d0471be3ef4655575f91cf2abcd4eb9a85184e0844 \ - --hash=sha256:b7fd0904ffee67d944ffa9b1b98975aa75676d73799ede7ed445f9bae6e425d6 \ - --hash=sha256:c1df6c552f381cdd0cbfb85da461f05f350f0625e3cc3bfd9c0a28216a72be3a \ - --hash=sha256:c284efaa45d53fe272b488ef7f142781e36fc89048812c2cc8978b586f4dd5de \ - --hash=sha256:e335453fed169a83af1e03a18a2a523bad02ae6f5c5048091e28ef1de124df97 \ - --hash=sha256:f2c5e47accca5b7f5bf3c1c7e21507f3d92091ae1a3e6f3dd278698341fe9622 +aioquic==0.9.25 \ + --hash=sha256:0066c0867c7c78aad05cd1f7ebcc1a61b61f3dbc57e65823df26edc0098b6c75 \ + --hash=sha256:18658be4dc06eb1cba9a7bbc80b716b25d3dcbfb89360575de9e2b66c0bee6a7 \ + --hash=sha256:3fad05736e0152e698a3fd18d421bab1a77f379ff085b953e306e53df00d0b9e \ + --hash=sha256:4032a718dea1cc670379dcac15da6ee49440ffaffca565d4505c74f6ac56bb34 \ + --hash=sha256:45241ac5b9b6d4cd976109220dfecddc377d610d4675fffb69869bedcdfa841c \ + --hash=sha256:4ab61fe290e3eed71e2f0ee1dd6916040adc087fc2d4f9dc0dfd037c09a6defc \ + --hash=sha256:4d4641eee9cdd05b9c11088077b376423f8ed148f198d491d72d8189596f1aaf \ + --hash=sha256:4d8b00e2fbf6fee5c9bb5e6d481f1d414f9a3318ae500f673470f6571f2455dd \ + --hash=sha256:70795c78905326d855c2ae524072234aae586c789b81292e272d021e9b0430a3 \ + --hash=sha256:7e4f592f0ad0d57753c7d3851f75041052528b76a7255011294b208c6a9e360b \ + --hash=sha256:7fb11167019d24ec9b5c62e40cef365a4911cd74f5fb23a1283d772e92c8ef7d \ + --hash=sha256:7fd3b0e42e3dab1ca7396fbb6810deb3a0d9324bfc730fb4a7697de08f1b4dc3 \ + --hash=sha256:827652aa7b52ac069fc1fc9b1d8308f6c19adcfb86cd7f563c0ce5be8b416ce9 \ + --hash=sha256:9852358f7bbb52c56e1151fa054505a3880f1d2cffef8a83a1bbb653a2faaab0 \ + --hash=sha256:9a416579f78177ea3590fdb16933f6168f425f9109fcad00e09b3ac3f991d0bb \ + --hash=sha256:9a7a69f4396540e38caf2cf3f69f42844a9130e3dac2590fd8713d5dc77b3a1f \ + --hash=sha256:bac804af55b230acaebefc33eb04356df1844cc77da5f4a7f860cbe41052553d \ + --hash=sha256:bb187080955b026da4d3c9ea5fa1be32c4413e27bd8e458f66d94bf9a2b42e72 \ + --hash=sha256:cbd60cec8cc8e134dc1e2ebb79047827298b84d3b5ff011c36ee101110da63b8 \ + --hash=sha256:d8637030a95f68454cdaa58c0a7d0cbee5eca1e694a5cb8d6c179846f7d4d86c \ + --hash=sha256:da07befc3fa186621a6ff34695d9bf51c803e49f6c02fec53f50c86b74cdd55f \ + --hash=sha256:dd1cda94f7c5e1a4bb75a2f195c0f20839b54b014e3d81eeab47d6a625c7a761 \ + --hash=sha256:f73db85db29e35260f85961840d5089c3da3e404c6b7dfdaadbd9842a53c10a1 # via -r requirements.in aiosignal==1.3.1 \ --hash=sha256:54cd96e15e1649b75d6c87526a6ff0b6c1b0dd3459f43d9ca11d48c339b68cfc \ @@ -445,6 +445,7 @@ cryptography==41.0.7 \ --hash=sha256:f983596065a18a2183e7f79ab3fd4c475205b839e02cbc0efbbf9666c4b3083d # via # -r requirements.in + # aioquic # pyjwt # pyopenssl # service-identity diff --git a/tools/code_format/config.yaml b/tools/code_format/config.yaml index c2afdd7b4117..726716339de8 100644 --- a/tools/code_format/config.yaml +++ b/tools/code_format/config.yaml @@ -103,7 +103,6 @@ paths: - source/common/upstream/subset_lb_config.cc - source/common/upstream/load_balancer_impl.cc - source/common/upstream/cluster_manager_impl.cc - - source/common/upstream/outlier_detection_impl.cc - source/common/upstream/upstream_impl.cc - source/common/upstream/default_local_address_selector_factory.cc - source/common/network/listen_socket_impl.cc