_consoleKey = None
_healthCheckName = 'a.root-servers.net.'
_healthCheckCounter = 0
- _healthCheckAnswerUnexpected = False
+ _answerUnexpected = True
@classmethod
def startResponders(cls):
response.id = request.id
toQueue.put(request, True, cls._queueTimeout)
- if not response and (healthCheck or cls._healthCheckAnswerUnexpected):
- # unexpected query, or health check
- response = dns.message.make_response(request)
+ if not response:
+ if healthCheck:
+ response = dns.message.make_response(request)
+ elif cls._answerUnexpected:
+ response = dns.message.make_response(request)
+ response.set_rcode(dns.rcode.SERVFAIL)
return response
self.assertGreaterEqual(values['blocks'], minBlocks)
self.assertLessEqual(values['blocks'], maxBlocks)
- def doTestQRate(self, name, testViaAPI=False):
+ def doTestQRate(self, name, testViaAPI=True):
query = dns.message.make_query(name, 'A', 'IN')
response = dns.message.make_response(query)
rrset = dns.rrset.from_text(name,
Dyn Blocks: QRate
"""
name = 'qrate.dynblocks.tests.powerdns.com.'
- self.doTestQRate(name, testViaAPI=True)
+ self.doTestQRate(name)
class TestDynBlockGroupQPS(DynBlocksTest):
Dyn Blocks (Group): QRate
"""
name = 'qrate.group.dynblocks.tests.powerdns.com.'
- self.doTestQRate(name, testViaAPI=True)
+ self.doTestQRate(name)
class TestDynBlockQPSRefused(DynBlocksTest):
# because it uses a different health check configuration
_testServerPort = 5384
- _healthCheckAnswerUnexpected = False
+ _answerUnexpected = False
_config_template = """
setKey("%s")
controlSocket("127.0.0.1:%d")
# this test suite uses a different responder port
# because it uses a different health check configuration
_testServerPort = 5385
- _healthCheckAnswerUnexpected = False
+ _answerUnexpected = False
_healthCheckName = 'powerdns.com.'
_config_template = """
# this test suite uses a different responder port
# because it uses a different health check configuration
_testServerPort = 5395
- _healthCheckAnswerUnexpected = True
+ _answerUnexpected = True
_tcpIdleTimeout = 2
_maxTCPQueriesPerConn = 5