BIND 10 trac2853, updated. dcd88c02239b954f9617f998852c4399ff1f9a75 [2853] Test that ZoneWriter methods throw
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jun 11 08:36:20 UTC 2013
The branch, trac2853 has been updated
via dcd88c02239b954f9617f998852c4399ff1f9a75 (commit)
via 9d2bd293b53d41efc0eb27c3f7e6cff01d264c8d (commit)
from 2cba268b3ae90e44b92227ebbbfa15e0fd3bdb5b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit dcd88c02239b954f9617f998852c4399ff1f9a75
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Jun 11 14:06:10 2013 +0530
[2853] Test that ZoneWriter methods throw
commit 9d2bd293b53d41efc0eb27c3f7e6cff01d264c8d
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Jun 11 14:05:51 2013 +0530
[2853] Fix args type for load() method
-----------------------------------------------------------------------
Summary of changes:
.../python/isc/datasrc/tests/clientlist_test.py | 66 +++++++++++++-------
src/lib/python/isc/datasrc/zonewriter_python.cc | 2 +-
2 files changed, 45 insertions(+), 23 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/datasrc/tests/clientlist_test.py b/src/lib/python/isc/datasrc/tests/clientlist_test.py
index 4172974..1e6c3c9 100644
--- a/src/lib/python/isc/datasrc/tests/clientlist_test.py
+++ b/src/lib/python/isc/datasrc/tests/clientlist_test.py
@@ -65,6 +65,15 @@ class ClientListTest(unittest.TestCase):
self.assertRaises(TypeError, isc.datasrc.ConfigurableClientList,
isc.dns.RRClass.IN, isc.dns.RRClass.IN)
+ def configure_helper(self):
+ self.clist.configure('''[{
+ "type": "MasterFiles",
+ "params": {
+ "example.org": "''' + TESTDATA_PATH + '''example.org.zone"
+ },
+ "cache-enable": true
+ }]''', True)
+
def test_configure(self):
"""
Test we can configure the client list. This tests if the valid
@@ -80,13 +89,7 @@ class ClientListTest(unittest.TestCase):
self.assertIsNone(finder)
self.assertFalse(exact)
# We can use this type, as it is not loaded dynamically.
- self.clist.configure('''[{
- "type": "MasterFiles",
- "params": {
- "example.org": "''' + TESTDATA_PATH + '''example.org.zone"
- },
- "cache-enable": true
- }]''', True)
+ self.configure_helper()
# Check the zone is there now. Proper tests of find are in other
# test methods.
self.dsrc, self.finder, exact = \
@@ -156,14 +159,7 @@ class ClientListTest(unittest.TestCase):
etc.
"""
self.clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
- self.clist.configure('''[{
- "type": "MasterFiles",
- "params": {
- "example.org": "''' + TESTDATA_PATH + '''example.org.zone"
- },
- "cache-enable": true
- }]''', True)
-
+ self.configure_helper()
self.find_helper()
@unittest.skipIf(os.environ['HAVE_SHARED_MEMORY'] != 'yes',
@@ -204,6 +200,38 @@ class ClientListTest(unittest.TestCase):
# The segment is still in READ_ONLY mode.
self.find_helper()
+ def test_zone_writer_load_twice(self):
+ """
+ Test that the zone writer throws when load() is called more than
+ once.
+ """
+
+ self.clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
+ self.configure_helper()
+
+ result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.org"))
+ self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_ZONE_SUCCESS,
+ result)
+ err_msg = self.__zone_writer.load()
+ self.assertIsNone(err_msg)
+ self.assertRaises(isc.datasrc.Error, self.__zone_writer.load)
+ self.__zone_writer.cleanup()
+
+ def test_zone_writer_install_without_load(self):
+ """
+ Test that the zone writer throws when install() is called
+ without calling load() first.
+ """
+
+ self.clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
+ self.configure_helper()
+
+ result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.org"))
+ self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_ZONE_SUCCESS,
+ result)
+ self.assertRaises(isc.datasrc.Error, self.__zone_writer.install)
+ self.__zone_writer.cleanup()
+
def test_get_status(self):
"""
Test getting status of various data sources.
@@ -216,13 +244,7 @@ class ClientListTest(unittest.TestCase):
self.assertIsInstance(status, list)
self.assertEqual(0, len(status))
- self.clist.configure('''[{
- "type": "MasterFiles",
- "params": {
- "example.org": "''' + TESTDATA_PATH + '''example.org.zone"
- },
- "cache-enable": true
- }]''', True)
+ self.configure_helper()
status = self.clist.get_status()
self.assertIsNotNone(status)
diff --git a/src/lib/python/isc/datasrc/zonewriter_python.cc b/src/lib/python/isc/datasrc/zonewriter_python.cc
index 713c44d..b3783e8 100644
--- a/src/lib/python/isc/datasrc/zonewriter_python.cc
+++ b/src/lib/python/isc/datasrc/zonewriter_python.cc
@@ -145,7 +145,7 @@ ZoneWriter_cleanup(PyObject* po_self, PyObject*) {
// 3. Argument type
// 4. Documentation
PyMethodDef ZoneWriter_methods[] = {
- { "load", ZoneWriter_load, METH_VARARGS,
+ { "load", ZoneWriter_load, METH_NOARGS,
ZoneWriter_load_doc },
{ "install", ZoneWriter_install, METH_NOARGS,
ZoneWriter_install_doc },
More information about the bind10-changes
mailing list