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

[1372] covered NotImplemented case

parent 5cea4cfb
...@@ -143,6 +143,8 @@ class MockDataSrcClient: ...@@ -143,6 +143,8 @@ class MockDataSrcClient:
def get_journal_reader(self, zone_name, begin_serial, end_serial): def get_journal_reader(self, zone_name, begin_serial, end_serial):
if zone_name == Name(''): if zone_name == Name(''):
return isc.datasrc.ZoneJournalReader.NO_SUCH_ZONE, None return isc.datasrc.ZoneJournalReader.NO_SUCH_ZONE, None
if zone_name == Name(''):
raise isc.datasrc.NotImplemented('journaling not supported')
if begin_serial == IXFR_NG_VERSION: if begin_serial == IXFR_NG_VERSION:
return isc.datasrc.ZoneJournalReader.NO_SUCH_VERSION, None return isc.datasrc.ZoneJournalReader.NO_SUCH_VERSION, None
return isc.datasrc.ZoneJournalReader.SUCCESS, self return isc.datasrc.ZoneJournalReader.SUCCESS, self
...@@ -710,6 +712,11 @@ class TestXfroutSession(TestXfroutSessionBase): ...@@ -710,6 +712,11 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertNotEqual(None, self.xfrsess._iterator) self.assertNotEqual(None, self.xfrsess._iterator)
self.assertEqual(None, self.xfrsess._jnl_reader) self.assertEqual(None, self.xfrsess._jnl_reader)
# The data source doesn't support journaling. Should fallback to AXFR.
self.getmsg(), Name('')), Rcode.NOERROR())
self.assertNotEqual(None, self.xfrsess._iterator)
# Failure cases # Failure cases
self.assertEqual(self.xfrsess._xfrout_setup( self.assertEqual(self.xfrsess._xfrout_setup(
self.getmsg(), Name('')), Rcode.NOTAUTH()) self.getmsg(), Name('')), Rcode.NOTAUTH())
...@@ -381,11 +381,18 @@ class XfroutSession(): ...@@ -381,11 +381,18 @@ class XfroutSession():
rcode, self._soa = self._get_zone_soa(zone_name) rcode, self._soa = self._get_zone_soa(zone_name)
if rcode != Rcode.NOERROR(): if rcode != Rcode.NOERROR():
return rcode return rcode
code, self._jnl_reader = self._datasrc_client.get_journal_reader( code, self._jnl_reader = self._datasrc_client.get_journal_reader(
zone_name, get_soa_serial(remote_soa.get_rdata()[0]), zone_name, get_soa_serial(remote_soa.get_rdata()[0]),
get_soa_serial(self._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: if code == ZoneJournalReader.NO_SUCH_VERSION:
# fallback to AXFR-style IXFR # fallback to AXFR-style IXFR
# TBD: log it.
return self.__setup_axfr(zone_name) return self.__setup_axfr(zone_name)
if code == ZoneJournalReader.NO_SUCH_ZONE: if code == ZoneJournalReader.NO_SUCH_ZONE:
# this is quite unexpected as we know zone's SOA exists. # this is quite unexpected as we know zone's SOA exists.
Supports Markdown
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