From a66eacd639f583481706d36503d6de587a373523 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 11 Dec 2017 13:46:13 +0100 Subject: [PATCH] rec: Use the SyncRes time in our unit tests when checking cache validity This might not fix our apparently random failures, but it will at least remove on possible cause. --- pdns/recursordist/test-syncres_cc.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pdns/recursordist/test-syncres_cc.cc b/pdns/recursordist/test-syncres_cc.cc index d76841508..b6cdc579f 100644 --- a/pdns/recursordist/test-syncres_cc.cc +++ b/pdns/recursordist/test-syncres_cc.cc @@ -1924,7 +1924,7 @@ BOOST_AUTO_TEST_CASE(test_flawed_nsset) { }); /* we populate the cache with a flawed NSset, i.e. there is a NS entry but no corresponding glue */ - time_t now = time(nullptr); + time_t now = sr->getNow().tv_sec; std::vector records; std::vector > sigs; addRecordToList(records, target, QType::NS, "pdns-public-ns1.powerdns.com.", DNSResourceRecord::AUTHORITY, now + 3600); @@ -1986,7 +1986,7 @@ BOOST_AUTO_TEST_CASE(test_cache_hit) { }); /* we populate the cache with eveything we need */ - time_t now = time(nullptr); + time_t now = sr->getNow().tv_sec; std::vector records; std::vector > sigs; @@ -2051,7 +2051,7 @@ BOOST_AUTO_TEST_CASE(test_cache_min_max_ttl) { return 0; }); - const time_t now = time(nullptr); + const time_t now = sr->getNow().tv_sec; SyncRes::s_minimumTTL = 60; SyncRes::s_maxcachettl = 3600; @@ -2102,7 +2102,7 @@ BOOST_AUTO_TEST_CASE(test_cache_expired_ttl) { }); /* we populate the cache with entries that expired 60s ago*/ - time_t now = time(nullptr); + time_t now = sr->getNow().tv_sec; std::vector records; std::vector > sigs; addRecordToList(records, target, QType::A, "192.0.2.42", DNSResourceRecord::ANSWER, now - 60); @@ -8483,7 +8483,7 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_negcache_validity) { return 0; }); - const time_t now = time(nullptr); + const time_t now = sr->getNow().tv_sec; vector ret; int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); @@ -8549,7 +8549,7 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_cache_validity) { return 0; }); - const time_t now = time(nullptr); + const time_t now = sr->getNow().tv_sec; vector ret; int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); -- 2.40.0