Commit 0c88eb0d authored by Jelte Jansen's avatar Jelte Jansen
Browse files

Merge branch 'trac1289'

parents 8eb6232b 9ec6d23a
......@@ -830,7 +830,7 @@ checkConfigElementString(ConstElementPtr config, const std::string& name,
if (!config->contains(name)) {
"Config for memory backend does not contain a '"
"' value");
return false;
} else if (!config->get(name) ||
import sys
import os
# The datasource factory loader uses dlopen, as does python
# for its modules. Some dynamic linkers do not play nice if
# modules are not loaded with RTLD_GLOBAL, a symptom of which
# is that exceptions are not recognized by type. So to make
# sure this doesn't happen, we temporarily set RTLD_GLOBAL
# during the loading of the datasource wrappers.
import ctypes
flags = sys.getdlopenflags()
sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL)
# this setup is a temporary workaround to deal with the problem of
# having both 'normal' python modules and a wrapper module
# Once all programs use the new interface, we should remove the
......@@ -16,6 +26,10 @@ if intree:
from datasrc import *
from isc.datasrc.datasrc import *
# revert to the default dlopen flags
from isc.datasrc.sqlite3_ds import *
from isc.datasrc.master import *
......@@ -19,6 +19,7 @@ import isc.dns
import unittest
import os
import shutil
import json
TESTDATA_PATH = os.environ['TESTDATA_PATH'] + os.sep
......@@ -381,7 +382,39 @@ class DataSrcUpdater(unittest.TestCase):
self.assertEqual(" 3600 IN A\n",
def test_two_modules(self):
# load two modules, and check if they don't interfere
mem_cfg = { "type": "memory", "class": "IN", "zones": [] };
dsc_mem = isc.datasrc.DataSourceClient("memory", json.dumps(mem_cfg))
dsc_sql = isc.datasrc.DataSourceClient("sqlite3", READ_ZONE_DB_CONFIG)
# check if exceptions are working
self.assertRaises(isc.datasrc.Error, isc.datasrc.DataSourceClient,
"memory", "{}")
self.assertRaises(isc.datasrc.Error, isc.datasrc.DataSourceClient,
"sqlite3", "{}")
# see if a lookup succeeds in sqlite3 ds
result, finder = dsc_sql.find_zone(isc.dns.Name(""))
self.assertEqual(finder.SUCCESS, result)
self.assertEqual(isc.dns.RRClass.IN(), finder.get_class())
self.assertEqual("", finder.get_origin().to_text())
result, rrset = finder.find(isc.dns.Name(""),
self.assertEqual(finder.SUCCESS, result)
self.assertEqual(" 3600 IN A\n",
# see if a lookup fails in mem ds
result, finder = dsc_mem.find_zone(isc.dns.Name(""))
self.assertEqual(finder.NXDOMAIN, result)
def test_update_delete_abort(self):
# we don't do enything with this one, just making sure loading two
# datasources
dsc = isc.datasrc.DataSourceClient("sqlite3", WRITE_ZONE_DB_CONFIG)
# first make sure, through a separate finder, that some record 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