import glob
e = xml.etree.ElementTree.parse('pytest.xml')
-root = e.getroot()
+testsuites = e.getroot()
-for child in root:
- if len(child):
+for testsuite in testsuites:
+ if len(testsuite):
getstdout = False
- for elem in child:
- if elem.tag in ["failure", "error"]:
- cls = child.get("classname")
- name = child.get("name")
- if '_' not in cls or '.' not in cls:
- print('Unexpected classname %s; name %s' % (cls, name))
- getstdout = True
- continue
+ for testcase in testsuite:
+ cls = testcase.get("classname")
+ name = testcase.get("name")
+ if '_' not in cls or '.' not in cls:
+ print('Unexpected classname %s; name %s' % (cls, name))
+ getstdout = True
+ continue
- confdirnames = [cls.split('_')[1].split('.')[0], cls.split('.')[1].split('Test')[0]]
- for confdirname in confdirnames:
- confdir = os.path.join("configs", confdirname)
- recursorlog = os.path.join(confdir, "recursor.log")
- if os.path.exists(recursorlog):
- print("==============> %s <==============" % recursorlog)
- with open(recursorlog) as f:
- print(''.join(f.readlines()))
- authdirs = glob.glob(os.path.join(confdir, "auth-*"))
- for authdir in authdirs:
- authlog = os.path.join(authdir, "pdns.log")
- if os.path.exists(recursorlog):
- print("==============> %s <==============" % authlog)
- with open(authlog) as f:
- print(''.join(f.readlines()))
- if getstdout and elem.tag == 'system-out':
- print("==============> STDOUT LOG FROM XML <==============")
- print(elem.text)
- print("==============> END STDOUT LOG FROM XML <==============")
+ confdirnames = [cls.split('_')[1].split('.')[0], cls.split('.')[1].split('Test')[0]]
+ found = False
+ for confdirname in confdirnames:
+ confdir = os.path.join("configs", confdirname)
+ recursorlog = os.path.join(confdir, "recursor.log")
+ if os.path.exists(recursorlog):
+ found = True
+ for elem in testcase:
+ if elem.tag in ["failure", "error"]:
+ print("==============> %s <==============" % recursorlog)
+ with open(recursorlog) as f:
+ print(''.join(f.readlines()))
+ authdirs = glob.glob(os.path.join(confdir, "auth-*"))
+ for authdir in authdirs:
+ authlog = os.path.join(authdir, "pdns.log")
+ if os.path.exists(recursorlog):
+ print("==============> %s <==============" % authlog)
+ with open(authlog) as f:
+ print(''.join(f.readlines()))
+ if not found and confdirnames[0] != 'Flags':
+ print("%s not found, configdir does not mach expected pattern" % confdirnames)
+ if getstdout and elem.tag == 'system-out':
+ print("==============> STDOUT LOG FROM XML <==============")
+ print(elem.text)
+ print("==============> END STDOUT LOG FROM XML <==============")
import os
from recursortests import RecursorTest
-class testAdditionalsDefault(RecursorTest):
+class AdditionalsDefaultTest(RecursorTest):
_confdir = 'AdditionalsDefault'
_config_template = """
self.assertRRsetInAdditional(res, adds1)
self.assertRRsetInAdditional(res, adds2)
-class testAdditionalsResolveImmediately(RecursorTest):
+class AdditionalsResolveImmediatelyTest(RecursorTest):
_confdir = 'AdditionalsResolveImmediately'
_config_template = """
dnssec=validate
self.assertRRsetInAdditional(res, adds7)
self.assertMatchingRRSIGInAdditional(res, adds7)
-class testAdditionalsResolveCacheOnly(RecursorTest):
+class AdditionalsResolveCacheOnlyTest(RecursorTest):
_confdir = 'AdditionalsResolveCacheOnly'
_config_template = """
dnssec=validate
def tearDownClass(cls):
cls.tearDownRecursor()
-class testNoECS(ECSTest):
+class NoECSTest(ECSTest):
_confdir = 'NoECS'
_config_template = """edns-subnet-allow-list=
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testIncomingNoECS(ECSTest):
+class IncomingNoECSTest(ECSTest):
_confdir = 'IncomingNoECS'
_config_template = """edns-subnet-allow-list=
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected, scopeZeroResponse=True)
-class testECSByName(ECSTest):
+class ECSByNameTest(ECSTest):
_confdir = 'ECSByName'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testECSByNameLarger(ECSTest):
+class ECSByNameLargerTest(ECSTest):
_confdir = 'ECSByNameLarger'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testECSByNameSmaller(ECSTest):
- _confdir = 'ECSByNameLarger'
+class ECSByNameSmallerTest(ECSTest):
+ _confdir = 'ECSByNameSmaller'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
ecs-ipv4-bits=16
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testIncomingECSByName(ECSTest):
- _confdir = 'ECSIncomingByName'
+class IncomingECSByNameTest(ECSTest):
+ _confdir = 'IncomingECSByName'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
use-incoming-edns-subnet=yes
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected, ttlECS)
-class testIncomingECSByNameLarger(ECSTest):
- _confdir = 'ECSIncomingByNameLarger'
+class IncomingECSByNameLargerTest(ECSTest):
+ _confdir = 'IncomingECSByNameLarger'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
use-incoming-edns-subnet=yes
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected, ttlECS)
-class testIncomingECSByNameSmaller(ECSTest):
- _confdir = 'ECSIncomingByNameSmaller'
+class IncomingECSByNameSmallerTest(ECSTest):
+ _confdir = 'IncomingECSByNameSmaller'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
use-incoming-edns-subnet=yes
self.sendECSQuery(query, expected, ttlECS)
@unittest.skipIf(not have_ipv6(), "No IPv6")
-class testIncomingECSByNameV6(ECSTest):
- _confdir = 'ECSIncomingByNameV6'
+class IncomingECSByNameV6Test(ECSTest):
+ _confdir = 'IncomingECSByNameV6'
_config_template = """edns-subnet-allow-list=ecs-echo.example.
use-incoming-edns-subnet=yes
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected, ttlECS)
-class testECSNameMismatch(ECSTest):
+class ECSNameMismatchTest(ECSTest):
_confdir = 'ECSNameMismatch'
_config_template = """edns-subnet-allow-list=not-the-right-name.example.
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testECSByIP(ECSTest):
+class ECSByIPTest(ECSTest):
_confdir = 'ECSByIP'
_config_template = """edns-subnet-allow-list=%s.21
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testIncomingECSByIP(ECSTest):
- _confdir = 'ECSIncomingByIP'
+class IncomingECSByIPTest(ECSTest):
+ _confdir = 'IncomingECSByIP'
_config_template = """edns-subnet-allow-list=%s.21
use-incoming-edns-subnet=yes
self.sendECSQuery(query, expected)
-class testECSIPMismatch(ECSTest):
+class ECSIPMismatchTest(ECSTest):
_confdir = 'ECSIPMismatch'
_config_template = """edns-subnet-allow-list=192.0.2.1
query = dns.message.make_query(nameECS, 'TXT', 'IN', use_edns=True, options=[ecso], payload=512)
self.sendECSQuery(query, expected)
-class testECSWithProxyProtocoldRecursorTest(ECSTest):
- _confdir = 'ECSWithProxyProtocol'
+class ECSWithProxyProtocolRecursorTest(ECSTest):
+ _confdir = 'ECSWithProxyProtocolRecursor'
_config_template = """
ecs-add-for=2001:db8::1/128
edns-subnet-allow-list=ecs-echo.example.
self.assertRcodeEqual(res, dns.rcode.NOERROR)
self.assertRRsetInAnswer(res, expected)
-class testTooLargeToAddZeroScope(RecursorTest):
+class TooLargeToAddZeroScopeTest(RecursorTest):
_confdir = 'TooLargeToAddZeroScope'
_config_template = """
@classmethod
def generateRecursorConfig(cls, confdir):
- super(testTooLargeToAddZeroScope, cls).generateRecursorConfig(confdir)
+ super(TooLargeToAddZeroScopeTest, cls).generateRecursorConfig(confdir)
def testTooLarge(self):
qname = 'toolarge.ecs.'
class RecursorEDNSPaddingTest(RecursorTest):
+ _confdir = 'RecursorEDNSPadding'
+
@classmethod
def setUpClass(cls):
cls.setUpSockets()
class PaddingNotAllowedAlwaysTest(RecursorEDNSPaddingTest):
- _confdir = 'PaddingAlwaysNotAllowed'
+ _confdir = 'PaddingNotAllowedAlways'
_config_template = """edns-padding-from=127.0.0.2
edns-padding-mode=always
edns-padding-tag=7830
# we use the default tag (0) for padded responses, which will cause
# the same packet cache entry (with padding ) to be returned to a client
# not allowed by the edns-padding-from list
- _confdir = 'PaddingAlwaysSameTag'
+ _confdir = 'PaddingAllowedAlwaysSameTag'
_config_template = """edns-padding-from=127.0.0.1
edns-padding-mode=always
edns-padding-tag=0
from recursortests import RecursorTest
-class TestFlags(RecursorTest):
+class FlagsTest(RecursorTest):
_confdir = 'Flags'
_config_template = """dnssec=%s"""
_config_params = ['_dnssec_setting']
from recursortests import RecursorTest
class GettagRecursorTest(RecursorTest):
- _confdir = 'LuaGettag'
+ _confdir = 'GettagRecursor'
_config_template = """
log-common-errors=yes
gettag-needs-edns-options=yes
self.assertResponseMatches(query, expected, res)
class GettagRecursorDistributesQueriesTest(GettagRecursorTest):
- _confdir = 'LuaGettagDistributes'
+ _confdir = 'GettagRecursorDistributesQueries'
_config_template = """
log-common-errors=yes
gettag-needs-edns-options=yes
self.transport.write(response.to_wire(), address)
class LuaHooksRecursorTest(RecursorTest):
- _confdir = 'LuaHooks'
+ _confdir = 'LuaHooksRecursor'
_config_template = """
forward-zones=luahooks.example=%s.23
log-common-errors=yes
self.assertRcodeEqual(res, dns.rcode.NOERROR)
class LuaHooksRecursorDistributesTest(LuaHooksRecursorTest):
- _confdir = 'LuaHooksDistributes'
+ _confdir = 'LuaHooksRecursorDistributes'
_config_template = """
forward-zones=luahooks.example=%s.23
log-common-errors=yes
class LuaDNS64Test(RecursorTest):
"""Tests the dq.followupAction("getFakeAAAARecords")"""
- _confdir = 'lua-dns64'
+ _confdir = 'LuaDNS64'
_config_template = """
"""
_lua_dns_script_file = """
- DNS64 should kick in, generating an AAAA
"""
- _confdir = 'gettagffi-rpz-dns64'
+ _confdir = 'GettagFFIDNS64'
_config_template = """
dns64-prefix=64:ff9b::/96
"""
class PDNSRandomTest(RecursorTest):
"""Tests if pdnsrandom works"""
- _confdir = 'pdnsrandom'
+ _confdir = 'PDNSRandom'
_config_template = """
"""
_lua_dns_script_file = """
class PDNSFeaturesTest(RecursorTest):
"""Tests if pdns_features works"""
- _confdir = 'pdnsfeatures'
+ _confdir = 'PDNSFeatures'
_config_template = """
"""
_lua_dns_script_file = """
class PDNSGeneratingAnswerFromGettagTest(RecursorTest):
"""Tests that we can generate answers from gettag"""
- _confdir = 'gettaganswers'
+ _confdir = 'PDNSGeneratingAnswerFromGettag'
_config_template = """
"""
_lua_dns_script_file = """
class PDNSValidationStatesTest(RecursorTest):
"""Tests that we have access to the validation states from Lua"""
- _confdir = 'validation-states-from-lua'
+ _confdir = 'PDNSValidationStates'
_config_template = """
dnssec=validate
"""
"""Tests the interaction between RPZ and followup queries (dns64, followCNAME)
"""
- _confdir = 'policyeventfilter-followup'
+ _confdir = 'PolicyEventFilterOnFollowUp'
_config_template = """
"""
_lua_config_file = """
"""Tests the interaction between followup queries and native dns64
"""
- _confdir = 'policyeventfilter-followup-dns64'
+ _confdir = 'PolicyEventFilterOnFollowUpWithNativeDNS64'
_config_template = """
dns64-prefix=1234::/96
"""
class LuaPostResolveFFITest(RecursorTest):
"""Tests postresolve_ffi interface"""
- _confdir = 'LuaPostResolveFFITest'
+ _confdir = 'LuaPostResolveFFI'
_config_template = """
"""
_lua_dns_script_file = """
This test makes sure that we correctly export queries and response over protobuf with a proxyMapping
"""
- _confdir = 'ProtobufProxyMappingTest'
+ _confdir = 'ProtobufProxyMapping'
_config_template = """
auth-zones=example=configs/%s/example.zone
allow-from=3.4.5.0/24
This test makes sure that we correctly export queries and response over protobuf.
"""
- _confdir = 'ProtobufProxyMappingLogMappedTest'
+ _confdir = 'ProtobufProxyMappingLogMapped'
_config_template = """
auth-zones=example=configs/%s/example.zone
allow-from=3.4.5.0/0"
that the recursor at least connects to the protobuf server.
"""
- _confdir = 'OutgoingProtobuffWithECSMapping'
+ _confdir = 'OutgoingProtobufWithECSMapping'
_config_template = """
# Switch off QName Minimization, it generates much more protobuf messages
# (or make the test much more smart!)
"""
This test makes sure that we can correctly add extra meta fields (FFI version).
"""
- _confdir = 'ProtobufMetaFFITest'
+ _confdir = 'ProtobufMetaFFI'
_config_template = """
auth-zones=example=configs/%s/example.zone""" % _confdir
_lua_config_file = """
import os
from recursortests import RecursorTest
-class testRDNotAllowed(RecursorTest):
- _confdir = 'RDFlagNotAllowed'
+class RDNotAllowedTest(RecursorTest):
+ _confdir = 'RDNotAllowed'
_config_template = """
"""
self.assertRcodeEqual(res, dns.rcode.REFUSED)
self.assertAnswerEmpty(res)
-class testRDAllowed(RecursorTest):
- _confdir = 'RDFlagAllowed'
+class RDAllowedTest(RecursorTest):
+ _confdir = 'RDAllowed'
_config_template = """
disable-packetcache=yes
-- The first server is a bogus one, to test that we correctly fail over to the second one
rpzMaster({'127.0.0.1:9999', '127.0.0.1:%d'}, 'zone.rpz.', { refresh=1, includeSOA=true})
""" % (rpzServerPort)
- _confdir = 'RPZXFR'
+ _confdir = 'RPZXFRRecursor'
_wsPort = 8042
_wsTimeout = 2
_wsPassword = 'secretpassword'
This test makes sure that we correctly load RPZ zones from a file
"""
- _confdir = 'RPZFile'
+ _confdir = 'RPZFileRecursor'
_lua_config_file = """
rpzFile('configs/%s/zone.rpz', { policyName="zone.rpz.", includeSOA=true })
""" % (_confdir)
This test makes sure that we correctly load RPZ zones from a file with a default policy
"""
- _confdir = 'RPZFileDefaultPolicy'
+ _confdir = 'RPZFileDefaultPolRecursor'
_lua_config_file = """
rpzFile('configs/%s/zone.rpz', { policyName="zone.rpz.", defpol=Policy.NoAction })
""" % (_confdir)
This test makes sure that we correctly load RPZ zones from a file with a default policy, not overriding local data entries
"""
- _confdir = 'RPZFileDefaultPolicyNotOverrideLocal'
+ _confdir = 'RPZFileDefaultPolNotOverrideLocalRecursor'
_lua_config_file = """
rpzFile('configs/%s/zone.rpz', { policyName="zone.rpz.", defpol=Policy.NoAction, defpolOverrideLocalData=false })
""" % (_confdir)
This test makes sure that the recursor respects the RPZ ordering precedence rules
"""
- _confdir = 'RPZOrderingPrecedence'
+ _confdir = 'RPZOrderingPrecedenceRecursor'
_lua_config_file = """
rpzFile('configs/%s/zone.rpz', { policyName="zone.rpz."})
rpzFile('configs/%s/zone2.rpz', { policyName="zone2.rpz."})
This test makes sure that we correctly load RPZ zones from a file while being modified by Lua callbacks
"""
- _confdir = 'RPZFileModByLua'
+ _confdir = 'RPZFileModByLuaRecursor'
_lua_dns_script_file = """
function preresolve(dq)
if dq.qname:equal('zmod.example.') then
_wsTimeout = 2
_wsPassword = 'secretpassword'
_apiKey = 'secretapikey'
- _confdir = 'RPZIncomplete'
+ _confdir = 'RPZIncompleteRecursor'
_auth_zones = {
'8': {'threads': 1,
'zones': ['ROOT']},
-- The first server is a bogus one, to test that we correctly fail over to the second one
rpzMaster({'127.0.0.1:9999', '127.0.0.1:%d'}, 'zone.rpz.', { refresh=1 })
""" % (badrpzServerPort)
- _confdir = 'RPZXFRIncomplete'
+ _confdir = 'RPZXFRIncompleteRecursor'
_wsPort = 8042
_wsTimeout = 2
_wsPassword = 'secretpassword'
from recursortests import RecursorTest
-class testReadTrustAnchorsFromFile(RecursorTest):
- _confdir = 'ReadTAsFromFile'
+class ReadTrustAnchorsFromFileTest(RecursorTest):
+ _confdir = 'ReadTrustAnchorsFromFile'
_config_template = """dnssec=validate"""
_lua_config_file = """clearTA()
if outgoing1 == outgoing2:
break
-class testRootNXTrustDisabled(RootNXTrustRecursorTest):
+class RootNXTrustDisabledTest(RootNXTrustRecursorTest):
_confdir = 'RootNXTrustDisabled'
_wsPort = 8042
_wsTimeout = 2
self.assertEqual(res.edns, 0)
self.assertEqual(len(res.options), 0)
-class testRootNXTrustEnabled(RootNXTrustRecursorTest):
+class RootNXTrustEnabledTest(RootNXTrustRecursorTest):
_confdir = 'RootNXTrustEnabled'
_wsPort = 8042
_wsTimeout = 2
import os
from recursortests import RecursorTest
-class testBogusMaxTTL(RecursorTest):
+class BogusMaxTTLTest(RecursorTest):
_confdir = 'BogusMaxTTL'
_config_template = """dnssec=validate
from recursortests import RecursorTest
-class testTrustAnchorsEnabled(RecursorTest):
+class TrustAnchorsEnabledTest(RecursorTest):
"""This test will do a query for "trustanchor.server CH TXT" and hopes to get
a proper answer"""
self.assertRRsetInAnswer(result, expected)
-class testTrustAnchorsDisabled(RecursorTest):
+class TrustAnchorsDisabledTest(RecursorTest):
"""This test will do a query for "trustanchor.server CH TXT" and hopes to get
a proper answer"""