diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:14:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:14:48 +0000 |
commit | e10ff189aca57bba91933088195d4edda199cb20 (patch) | |
tree | 056237559582eba27e68fa864434436ac5b7f535 /test-dnsdistbackend_cc.cc | |
parent | Adding upstream version 1.8.3. (diff) | |
download | dnsdist-e10ff189aca57bba91933088195d4edda199cb20.tar.xz dnsdist-e10ff189aca57bba91933088195d4edda199cb20.zip |
Adding upstream version 1.9.3.upstream/1.9.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test-dnsdistbackend_cc.cc')
-rw-r--r-- | test-dnsdistbackend_cc.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test-dnsdistbackend_cc.cc b/test-dnsdistbackend_cc.cc index 983f912..28bf510 100644 --- a/test-dnsdistbackend_cc.cc +++ b/test-dnsdistbackend_cc.cc @@ -1,5 +1,8 @@ +#ifndef BOOST_TEST_DYN_LINK #define BOOST_TEST_DYN_LINK +#endif + #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> @@ -261,8 +264,8 @@ BOOST_AUTO_TEST_CASE(test_LazyExponentialBackOff) BOOST_CHECK_EQUAL(ds.getStatus(), "down"); BOOST_CHECK_EQUAL(ds.healthCheckRequired(currentTime), false); /* and the wait time between two checks will double every time a failure occurs */ - BOOST_CHECK_EQUAL(ds.getNextLazyHealthCheck(), (currentTime + (config.d_lazyHealthCheckFailedInterval * std::pow(2U, ds.currentCheckFailures)))); - BOOST_CHECK_EQUAL(ds.currentCheckFailures, 0U); + BOOST_CHECK_EQUAL(ds.getNextLazyHealthCheck(), (currentTime + (config.d_lazyHealthCheckFailedInterval * std::pow(2U, ds.currentCheckFailures - 1)))); + BOOST_CHECK_EQUAL(ds.currentCheckFailures, 1U); /* so after 5 failures */ const size_t nbFailures = 5; @@ -271,8 +274,8 @@ BOOST_AUTO_TEST_CASE(test_LazyExponentialBackOff) BOOST_CHECK(ds.healthCheckRequired(currentTime)); ds.submitHealthCheckResult(false, false); } - BOOST_CHECK_EQUAL(ds.currentCheckFailures, nbFailures); - BOOST_CHECK_EQUAL(ds.getNextLazyHealthCheck(), (currentTime + (config.d_lazyHealthCheckFailedInterval * std::pow(2U, ds.currentCheckFailures)))); + BOOST_CHECK_EQUAL(ds.currentCheckFailures, nbFailures + 1); + BOOST_CHECK_EQUAL(ds.getNextLazyHealthCheck(), (currentTime + (config.d_lazyHealthCheckFailedInterval * std::pow(2U, ds.currentCheckFailures - 1)))); /* we need minRiseSuccesses successful health-checks to go up */ BOOST_REQUIRE(config.minRiseSuccesses >= 1); |