Commit 2dd7ee33 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1372] covered NotImplemented case

parent 5cea4cfb
......@@ -143,6 +143,8 @@ class MockDataSrcClient:
def get_journal_reader(self, zone_name, begin_serial, end_serial):
if zone_name == Name('notauth2.example.com'):
return isc.datasrc.ZoneJournalReader.NO_SUCH_ZONE, None
if zone_name == Name('nojournal.example.com'):
raise isc.datasrc.NotImplemented('journaling not supported')
if begin_serial == IXFR_NG_VERSION:
return isc.datasrc.ZoneJournalReader.NO_SUCH_VERSION, None
return isc.datasrc.ZoneJournalReader.SUCCESS, self
......@@ -710,6 +712,11 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertNotEqual(None, self.xfrsess._iterator)
self.assertEqual(None, self.xfrsess._jnl_reader)
# The data source doesn't support journaling. Should fallback to AXFR.
self.assertEqual(self.xfrsess._xfrout_setup(
self.getmsg(), Name('nojournal.example.com')), Rcode.NOERROR())
self.assertNotEqual(None, self.xfrsess._iterator)
# Failure cases
self.assertEqual(self.xfrsess._xfrout_setup(
self.getmsg(), Name('notauth.example.com')), Rcode.NOTAUTH())
......
......@@ -381,11 +381,18 @@ class XfroutSession():
rcode, self._soa = self._get_zone_soa(zone_name)
if rcode != Rcode.NOERROR():
return rcode
code, self._jnl_reader = self._datasrc_client.get_journal_reader(
zone_name, get_soa_serial(remote_soa.get_rdata()[0]),
get_soa_serial(self._soa.get_rdata()[0]))
try:
code, self._jnl_reader = self._datasrc_client.get_journal_reader(
zone_name, get_soa_serial(remote_soa.get_rdata()[0]),
get_soa_serial(self._soa.get_rdata()[0]))
except isc.datasrc.NotImplemented as ex:
# The underlying data source doesn't support journaling.
# Fallback to AXFR-style IXFR.
# TBD: log it.
return self.__setup_axfr(zone_name)
if code == ZoneJournalReader.NO_SUCH_VERSION:
# fallback to AXFR-style IXFR
# TBD: log it.
return self.__setup_axfr(zone_name)
if code == ZoneJournalReader.NO_SUCH_ZONE:
# this is quite unexpected as we know zone's SOA exists.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment