]> git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.recursor-dnssec/test_TTL.py
Make sure we can install unsigned packages.
[thirdparty/pdns.git] / regression-tests.recursor-dnssec / test_TTL.py
1 import dns
2 import os
3 from recursortests import RecursorTest
4
5 class testBogusMaxTTL(RecursorTest):
6 _confdir = 'BogusMaxTTL'
7
8 _config_template = """dnssec=validate
9 max-cache-bogus-ttl=5"""
10
11 @classmethod
12 def setUp(cls):
13 confdir = os.path.join('configs', cls._confdir)
14 cls.wipeRecursorCache(confdir)
15
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)
21
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)