Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Nino committed Mar 30, 2017
1 parent b1e5845 commit 3825f62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/intro/arch_overview/outlier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ action

type
If ``action`` is ``eject``, specifies the type of ejection that took place. Currently this can be:
``5xx``, and ``SuccessRate``.
``5xx`` and ``SuccessRate``.

num_ejections
If ``action`` is ``eject``, specifies the number of times the host has been ejected
Expand Down
8 changes: 8 additions & 0 deletions test/common/upstream/outlier_detection_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xx) {
.WillOnce(Return(SystemTime(std::chrono::milliseconds(9999))));
EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000)));
interval_timer_->callback_();
EXPECT_FALSE(cluster_.hosts_[0]->outlierDetector().lastUnejectionTime().valid());

// Interval that does bring the host back in.
EXPECT_CALL(time_source_, currentSystemTime())
Expand All @@ -190,6 +191,7 @@ TEST_F(OutlierDetectorImplTest, BasicFlow5xx) {
EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000)));
interval_timer_->callback_();
EXPECT_FALSE(cluster_.hosts_[0]->healthFlagGet(Host::HealthFlag::FAILED_OUTLIER_CHECK));
EXPECT_TRUE(cluster_.hosts_[0]->outlierDetector().lastUnejectionTime().valid());

// Eject host again to cause an ejection after an unejection has taken place
loadRq(cluster_.hosts_[0], 1, 503);
Expand Down Expand Up @@ -254,6 +256,9 @@ TEST_F(OutlierDetectorImplTest, BasicFlowSuccessRate) {
EjectionType::SuccessRate, true));
EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000)));
interval_timer_->callback_();
EXPECT_EQ(50, cluster_.hosts_[4]->outlierDetector().successRate());
EXPECT_EQ(90, detector->successRateAverage());
EXPECT_EQ(52, detector->successRateEjectionThreshold());
EXPECT_TRUE(cluster_.hosts_[4]->healthFlagGet(Host::HealthFlag::FAILED_OUTLIER_CHECK));
EXPECT_EQ(1UL, cluster_.info_->stats_store_.gauge("outlier_detection.ejections_active").value());

Expand Down Expand Up @@ -285,6 +290,9 @@ TEST_F(OutlierDetectorImplTest, BasicFlowSuccessRate) {
EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(10000)));
interval_timer_->callback_();
EXPECT_EQ(0UL, cluster_.info_->stats_store_.gauge("outlier_detection.ejections_active").value());
EXPECT_EQ(-1, cluster_.hosts_[4]->outlierDetector().successRate());
EXPECT_EQ(-1, detector->successRateAverage());
EXPECT_EQ(-1, detector->successRateEjectionThreshold());
}

TEST_F(OutlierDetectorImplTest, RemoveWhileEjected) {
Expand Down

0 comments on commit 3825f62

Please sign in to comment.