]> git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.recursor-dnssec/test_TraceFail.py
Merge pull request #13927 from rgacogne/fix-fclose-warnings
[thirdparty/pdns.git] / regression-tests.recursor-dnssec / test_TraceFail.py
1 import dns
2 import os
3 import time
4 import subprocess
5 from recursortests import RecursorTest
6
7 class testTraceFail(RecursorTest):
8 _confdir = 'TraceFail'
9
10 _config_template = """
11 trace=fail
12 forward-zones-recurse=.=127.0.0.1:9999
13 """
14
15 @classmethod
16 def setUpClass(cls):
17
18 # we don't need all the auth stuff
19 cls.setUpSockets()
20 cls.startResponders()
21
22 confdir = os.path.join('configs', cls._confdir)
23 cls.createConfigDir(confdir)
24
25 cls.generateRecursorConfig(confdir)
26 cls.startRecursor(confdir, cls._recursorPort)
27
28 @classmethod
29 def tearDownClass(cls):
30 cls.tearDownRecursor()
31
32 def testA(self):
33 query = dns.message.make_query('example', 'A', want_dnssec=False)
34 res = self.sendUDPQuery(query)
35 self.assertRcodeEqual(res, dns.rcode.SERVFAIL)
36
37 grepCmd = ['grep', 'END OF FAIL TRACE', 'configs/' + self._confdir + '/recursor.log']
38 ret = b''
39 for i in range(10):
40 time.sleep(1)
41 try:
42 ret = subprocess.check_output(grepCmd, stderr=subprocess.STDOUT)
43 except subprocess.CalledProcessError as e:
44 continue
45 print(b'A' + ret)
46 break
47 print(ret)
48 self.assertNotEqual(ret, b'')