Skip to content

Commit

Permalink
Fix test and change name
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Konradi <akonradi@google.com>
  • Loading branch information
akonradi committed Nov 19, 2020
1 parent f22a548 commit 4c457c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions source/common/common/interval_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ template <typename T, T MinValue, T MaxValue> struct Interval {
};

// Utility type that represents a value of type T in the given interval.
template <typename T, typename Interval> class IntervalValue {
template <typename T, typename Interval> 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<T>(Interval::min_value, std::min<T>(Interval::max_value, value))) {}

T value() const { return value_; }
Expand All @@ -26,6 +26,6 @@ template <typename T, typename Interval> class IntervalValue {
T value_;
};

using UnitFloat = IntervalValue<float, Interval<int, 0, 1>>;
using UnitFloat = ClosedIntervalValue<float, Interval<int, 0, 1>>;

} // namespace Envoy
4 changes: 2 additions & 2 deletions test/common/http/conn_manager_impl_test_2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 4c457c3

Please sign in to comment.