|
@@ -729,6 +729,15 @@ class TestXfroutSession(TestXfroutSessionBase):
|
|
|
self.assertNotEqual(None, self.xfrsess._iterator)
|
|
|
self.assertEqual(None, self.xfrsess._jnl_reader)
|
|
|
|
|
|
+ # Successful case, but the requested SOA serial is equal to that of
|
|
|
+ # the local SOA. Both iterator and jnl_reader should be None,
|
|
|
+ # indicating that the response will contain just one SOA.
|
|
|
+ self.mdata = self.create_request_data(ixfr=SOA_CURRENT_VERSION)
|
|
|
+ self.assertEqual(self.xfrsess._xfrout_setup(
|
|
|
+ self.getmsg(), TEST_ZONE_NAME, TEST_RRCLASS), Rcode.NOERROR())
|
|
|
+ self.assertEqual(None, self.xfrsess._iterator)
|
|
|
+ self.assertEqual(None, self.xfrsess._jnl_reader)
|
|
|
+
|
|
|
# The data source doesn't support journaling. Should fallback to AXFR.
|
|
|
zone_name = Name('nojournal.example.com')
|
|
|
self.mdata = self.create_request_data(ixfr=IXFR_OK_VERSION,
|
|
@@ -851,7 +860,7 @@ class TestXfroutSession(TestXfroutSessionBase):
|
|
|
self.assertEqual(0, len(self.sock.sendqueue))
|
|
|
|
|
|
def test_reply_xfrout_query_ixfr(self):
|
|
|
- # Creating an pure (incremental) IXFR response. Intermediate SOA
|
|
|
+ # Creating a pure (incremental) IXFR response. Intermediate SOA
|
|
|
# RRs won't be skipped.
|
|
|
self.xfrsess._soa = create_soa(SOA_CURRENT_VERSION)
|
|
|
self.xfrsess._iterator = [create_soa(IXFR_OK_VERSION),
|
|
@@ -866,6 +875,20 @@ class TestXfroutSession(TestXfroutSessionBase):
|
|
|
self.assertEqual(reply_msg.get_rr_count(Message.SECTION_ANSWER),
|
|
|
len(self.xfrsess._iterator) + 2)
|
|
|
|
|
|
+ def test_reply_xfrout_query_ixfr_soa_only(self):
|
|
|
+ # Creating an IXFR response that contains only one RR, which is the
|
|
|
+ # SOA of the current version.
|
|
|
+ self.xfrsess._soa = create_soa(SOA_CURRENT_VERSION)
|
|
|
+ self.xfrsess._iterator = None
|
|
|
+ self.xfrsess._jnl_reader = None
|
|
|
+ self.xfrsess._reply_xfrout_query(self.getmsg(), self.sock)
|
|
|
+ reply_msg = self.sock.read_msg(Message.PRESERVE_ORDER)
|
|
|
+ answer = reply_msg.get_section(Message.SECTION_ANSWER)
|
|
|
+ self.assertEqual(1, len(answer))
|
|
|
+ self.assertEqual(RRType.SOA(), answer[0].get_type())
|
|
|
+ self.assertEqual(SOA_CURRENT_VERSION,
|
|
|
+ xfrout.get_soa_serial(answer[0].get_rdata()[0]))
|
|
|
+
|
|
|
class TestXfroutSessionWithSQLite3(TestXfroutSessionBase):
|
|
|
'''Tests for XFR-out sessions using an SQLite3 DB.
|
|
|
|
|
@@ -942,6 +965,19 @@ class TestXfroutSessionWithSQLite3(TestXfroutSessionBase):
|
|
|
self.assertEqual(SOA_CURRENT_VERSION,
|
|
|
xfrout.get_soa_serial(soa.get_rdata()[0]))
|
|
|
|
|
|
+ def test_ixfr_soa_only(self):
|
|
|
+ # The requested SOA serial is the latest one. The response should
|
|
|
+ # contain exactly one SOA of that serial.
|
|
|
+ self.xfrsess._request_data = \
|
|
|
+ self.create_request_data(ixfr=SOA_CURRENT_VERSION)
|
|
|
+ XfroutSession._handle(self.xfrsess)
|
|
|
+ response = self.sock.read_msg(Message.PRESERVE_ORDER);
|
|
|
+ answers = response.get_section(Message.SECTION_ANSWER)
|
|
|
+ self.assertEqual(1, len(answers))
|
|
|
+ self.assertEqual(RRType.SOA(), answers[0].get_type())
|
|
|
+ self.assertEqual(SOA_CURRENT_VERSION,
|
|
|
+ xfrout.get_soa_serial(answers[0].get_rdata()[0]))
|
|
|
+
|
|
|
class MyUnixSockServer(UnixSockServer):
|
|
|
def __init__(self):
|
|
|
self._shutdown_event = threading.Event()
|