BOOST_CHECK_EQUAL(SyncRes::getNegCacheSize(), 2U);
}
-BOOST_AUTO_TEST_CASE(test_skip_negcache_for_variable_response)
+BOOST_AUTO_TEST_CASE(test_dont_skip_negcache_for_variable_response)
{
std::unique_ptr<SyncRes> sr;
initSR(sr);
int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret);
BOOST_CHECK_EQUAL(res, RCode::NXDomain);
BOOST_CHECK_EQUAL(ret.size(), 2U);
- /* no negative cache entry because the response was variable */
- BOOST_CHECK_EQUAL(SyncRes::getNegCacheSize(), 0U);
+ BOOST_CHECK_EQUAL(SyncRes::getNegCacheSize(), 1U);
}
BOOST_AUTO_TEST_CASE(test_ecs_cache_limit_allowed)
and do an additional query for the CNAME target.
We have a regression test making sure we do exactly that.
*/
- if(!wasVariable() && newtarget.empty()) {
+ if (newtarget.empty()) {
t_sstorage.negcache.add(ne);
if(s_rootNXTrust && ne.d_auth.isRoot() && auth.isRoot() && lwr.d_aabit) {
ne.d_name = ne.d_name.getLastLabel();
}
LOG(prefix<<qname<<": got negative indication of DS record for '"<<newauth<<"'"<<endl);
- if(!wasVariable()) {
- t_sstorage.negcache.add(ne);
- }
+ t_sstorage.negcache.add(ne);
if (qname == newauth && qtype == QType::DS) {
/* we are actually done! */
}
ne.d_ttd = d_now.tv_sec + lowestTTL;
- if(!wasVariable()) {
- if(qtype.getCode()) { // prevents us from blacking out a whole domain
- t_sstorage.negcache.add(ne);
- }
+ if (qtype.getCode()) { // prevents us from NXDOMAIN'ing a whole domain
+ t_sstorage.negcache.add(ne);
}
ret.push_back(rec);