conn.send(wire)
while multipleResponses:
+ # do not block, and stop as soon as the queue is empty, either the next response is already here or we are done
+ # otherwise we might read responses intended for the next connection
if fromQueue.empty():
break
- response = fromQueue.get(True, cls._queueTimeout)
+ response = fromQueue.get(False)
if not response:
break
return (receivedQuery, messages)
def setUp(self):
- # This function is called before every tests
+ # This function is called before every test
# Clear the responses counters
self._responsesCounter.clear()
# Make sure the queues are empty, in case
# a previous test failed
- while not self._toResponderQueue.empty():
- self._toResponderQueue.get(False)
-
- while not self._fromResponderQueue.empty():
- self._fromResponderQueue.get(False)
+ self.clearResponderQueues()
super(DNSDistTest, self).setUp()
#!/usr/bin/env python
import threading
+import time
import dns
from dnsdisttests import DNSDistTest
_config_template = """
newServer{address="127.0.0.1:%s"}
"""
+ _verboseMode = True
@classmethod
def startResponders(cls):
cls._TCPResponder.setDaemon(True)
cls._TCPResponder.start()
+ def setUp(self):
+ # This function is called before every test
+ super(TestAXFR, self).setUp()
+ # make sure the TCP connection handlers from the previous test
+ # are not going to read our queue
+ time.sleep(1)
+
def testOneMessageAXFR(self):
"""
AXFR: One message
dns.rdatatype.SOA,
'ns.' + name + ' hostmaster.' + name + ' 3 3600 3600 3600 60')
- # the final SOA starts the AXFR, with first an update from 1 to 2 (one removal, two additions)
+ # the final SOA starts the IXFR, with first an update from 1 to 2 (one removal, two additions)
response = dns.message.make_response(query)
response.answer.append(finalSoa)
# update from 1 to 2