]>
git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.recursor-dnssec/test_TTL.py
3 from recursortests
import RecursorTest
5 class testBogusMaxTTL(RecursorTest
):
6 _confdir
= 'BogusMaxTTL'
8 _config_template
= """dnssec=validate
9 max-cache-bogus-ttl=5"""
13 confdir
= os
.path
.join('configs', cls
._confdir
)
14 cls
.wipeRecursorCache(confdir
)
16 def testBogusCheckDisabled(self
):
17 # first query with CD=0, so we should get a ServFail
18 query
= self
.createQuery('ted.bogus.example.', 'A', 'AD', 'DO')
19 res
= self
.sendUDPQuery(query
)
20 self
.assertRcodeEqual(res
, dns
.rcode
.SERVFAIL
)
22 # then with CD=1 so we should get the A + RRSIG
23 # check that we correctly applied the maximum TTL when caching Bogus entries
24 query
= self
.createQuery('ted.bogus.example.', 'A', 'AD CD', 'DO')
25 res
= self
.sendUDPQuery(query
)
26 self
.assertMessageHasFlags(res
, ['CD', 'QR', 'RA', 'RD'], ['DO'])
27 self
.assertRcodeEqual(res
, dns
.rcode
.NOERROR
)
28 self
.assertEquals(len(res
.answer
), 2)
29 for ans
in res
.answer
:
30 self
.assertLessEqual(ans
.ttl
, 5)