From 4c457c35ef627eea546657d5b7e2a0eb324a997b Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Thu, 19 Nov 2020 10:19:35 -0500 Subject: [PATCH] Fix test and change name Signed-off-by: Alex Konradi --- source/common/common/interval_value.h | 10 +++++----- test/common/http/conn_manager_impl_test_2.cc | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/common/common/interval_value.h b/source/common/common/interval_value.h index e67d05e1a201..6c7e4c785d59 100644 --- a/source/common/common/interval_value.h +++ b/source/common/common/interval_value.h @@ -12,12 +12,12 @@ template struct Interval { }; // Utility type that represents a value of type T in the given interval. -template class IntervalValue { +template class ClosedIntervalValue { public: - static IntervalValue min() { return IntervalValue(Interval::min_value); } - static IntervalValue max() { return IntervalValue(Interval::max_value); } + static ClosedIntervalValue min() { return ClosedIntervalValue(Interval::min_value); } + static ClosedIntervalValue max() { return ClosedIntervalValue(Interval::max_value); } - constexpr explicit IntervalValue(T value) + constexpr explicit ClosedIntervalValue(T value) : value_(std::max(Interval::min_value, std::min(Interval::max_value, value))) {} T value() const { return value_; } @@ -26,6 +26,6 @@ template class IntervalValue { T value_; }; -using UnitFloat = IntervalValue>; +using UnitFloat = ClosedIntervalValue>; } // namespace Envoy diff --git a/test/common/http/conn_manager_impl_test_2.cc b/test/common/http/conn_manager_impl_test_2.cc index 57bcd5d0697e..fc58ff2277f0 100644 --- a/test/common/http/conn_manager_impl_test_2.cc +++ b/test/common/http/conn_manager_impl_test_2.cc @@ -2070,7 +2070,7 @@ TEST(HttpConnectionManagerTracingStatsTest, verifyTracingStats) { } TEST_F(HttpConnectionManagerImplTest, NoNewStreamWhenOverloaded) { - Server::OverloadActionState stop_accepting_requests = Server::OverloadActionState(0.8); + Server::OverloadActionState stop_accepting_requests(UnitFloat(0.8)); ON_CALL(overload_manager_.overload_state_, getState(Server::OverloadActionNames::get().StopAcceptingRequests)) .WillByDefault(ReturnRef(stop_accepting_requests)); @@ -2095,7 +2095,7 @@ TEST_F(HttpConnectionManagerImplTest, NoNewStreamWhenOverloaded) { } TEST_F(HttpConnectionManagerImplTest, DisableHttp1KeepAliveWhenOverloaded) { - Server::OverloadActionState disable_http_keep_alive = Server::OverloadActionState(0.8); + Server::OverloadActionState disable_http_keep_alive(UnitFloat(0.8)); ON_CALL(overload_manager_.overload_state_, getState(Server::OverloadActionNames::get().DisableHttpKeepAlive)) .WillByDefault(ReturnRef(disable_http_keep_alive));