Commit b8679425 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2853] Fix paths to testfiles

Use testdata/ in this directory for test data. Also switch to testing
with the example.com zone to match the test zone data.
parent bee3ea9f
......@@ -47,7 +47,6 @@ endif
TESTDATA_PATH=$(abs_srcdir)/testdata \
TESTDATA_WRITE_PATH=$(abs_builddir) \
HAVE_SHARED_MEMORY=$(HAVE_SHARED_MEMORY) \
GLOBAL_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/testutils/testdata \
B10_FROM_BUILD=$(abs_top_builddir) \
$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
done
......@@ -20,7 +20,7 @@ import unittest
import os
import sys
TESTDATA_PATH = os.environ['GLOBAL_TESTDATA_PATH'] + os.sep
TESTDATA_PATH = os.environ['TESTDATA_PATH'] + os.sep
MAPFILE_PATH = os.environ['TESTDATA_WRITE_PATH'] + os.sep + 'test.mapped'
class ClientListTest(unittest.TestCase):
......@@ -69,7 +69,7 @@ class ClientListTest(unittest.TestCase):
self.clist.configure('''[{
"type": "MasterFiles",
"params": {
"example.org": "''' + TESTDATA_PATH + '''example.org.zone"
"example.com": "''' + TESTDATA_PATH + '''example.com"
},
"cache-enable": true
}]''', True)
......@@ -84,7 +84,7 @@ class ClientListTest(unittest.TestCase):
# This should be NOP now
self.clist.configure("[]", True)
# Check the zone is not there yet
dsrc, finder, exact = self.clist.find(isc.dns.Name("example.org"))
dsrc, finder, exact = self.clist.find(isc.dns.Name("example.com"))
self.assertIsNone(dsrc)
self.assertIsNone(finder)
self.assertFalse(exact)
......@@ -93,7 +93,7 @@ class ClientListTest(unittest.TestCase):
# Check the zone is there now. Proper tests of find are in other
# test methods.
self.dsrc, self.finder, exact = \
self.clist.find(isc.dns.Name("example.org"))
self.clist.find(isc.dns.Name("example.com"))
self.assertIsNotNone(self.dsrc)
self.assertTrue(isinstance(self.dsrc, isc.datasrc.DataSourceClient))
self.assertIsNotNone(self.finder)
......@@ -112,7 +112,7 @@ class ClientListTest(unittest.TestCase):
self.assertRaises(TypeError, self.clist.configure, "[]", "true")
def find_helper(self):
dsrc, finder, exact = self.clist.find(isc.dns.Name("sub.example.org"))
dsrc, finder, exact = self.clist.find(isc.dns.Name("sub.example.com"))
self.assertIsNotNone(dsrc)
self.assertTrue(isinstance(dsrc, isc.datasrc.DataSourceClient))
self.assertIsNotNone(finder)
......@@ -126,31 +126,31 @@ class ClientListTest(unittest.TestCase):
# We check an exact match in test_configure already
self.assertFalse(exact)
self.dsrc, self.finder, exact = \
self.clist.find(isc.dns.Name("sub.example.org"), False)
self.clist.find(isc.dns.Name("sub.example.com"), False)
self.assertIsNotNone(self.dsrc)
self.assertTrue(isinstance(self.dsrc, isc.datasrc.DataSourceClient))
self.assertIsNotNone(self.finder)
self.assertTrue(isinstance(self.finder, isc.datasrc.ZoneFinder))
self.assertFalse(exact)
self.dsrc, self.finder, exact = \
self.clist.find(isc.dns.Name("sub.example.org"), True)
self.clist.find(isc.dns.Name("sub.example.com"), True)
self.assertIsNone(self.dsrc)
self.assertIsNone(self.finder)
self.assertFalse(exact)
self.dsrc, self.finder, exact = \
self.clist.find(isc.dns.Name("sub.example.org"), False, False)
self.clist.find(isc.dns.Name("sub.example.com"), False, False)
self.assertIsNotNone(self.dsrc)
self.assertTrue(isinstance(self.dsrc, isc.datasrc.DataSourceClient))
self.assertIsNotNone(self.finder)
self.assertTrue(isinstance(self.finder, isc.datasrc.ZoneFinder))
self.assertFalse(exact)
self.dsrc, self.finder, exact = \
self.clist.find(isc.dns.Name("sub.example.org"), True, False)
self.clist.find(isc.dns.Name("sub.example.com"), True, False)
self.assertIsNone(self.dsrc)
self.assertIsNone(self.finder)
self.assertFalse(exact)
# Some invalid inputs
self.assertRaises(TypeError, self.clist.find, "example.org")
self.assertRaises(TypeError, self.clist.find, "example.com")
self.assertRaises(TypeError, self.clist.find)
def test_find(self):
......@@ -172,7 +172,7 @@ class ClientListTest(unittest.TestCase):
self.clist.configure('''[{
"type": "MasterFiles",
"params": {
"example.org": "''' + TESTDATA_PATH + '''example.org.zone"
"example.com": "''' + TESTDATA_PATH + '''example.com"
},
"cache-enable": true,
"cache-type": "mapped"
......@@ -182,7 +182,7 @@ class ClientListTest(unittest.TestCase):
self.clist.reset_memory_segment("MasterFiles",
isc.datasrc.ConfigurableClientList.CREATE,
map_params)
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.org"))
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.com"))
self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_ZONE_SUCCESS,
result)
err_msg = self.__zone_writer.load()
......@@ -193,7 +193,7 @@ class ClientListTest(unittest.TestCase):
self.clist.reset_memory_segment("MasterFiles",
isc.datasrc.ConfigurableClientList.READ_ONLY,
map_params)
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.org"))
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.com"))
self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_CACHE_NOT_WRITABLE,
result)
......@@ -209,7 +209,7 @@ class ClientListTest(unittest.TestCase):
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"))
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.com"))
self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_ZONE_SUCCESS,
result)
err_msg = self.__zone_writer.load()
......@@ -226,7 +226,7 @@ class ClientListTest(unittest.TestCase):
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"))
result, self.__zone_writer = self.clist.get_cached_zone_writer(isc.dns.Name("example.com"))
self.assertEqual(isc.datasrc.ConfigurableClientList.CACHE_STATUS_ZONE_SUCCESS,
result)
self.assertRaises(isc.datasrc.Error, self.__zone_writer.install)
......@@ -265,9 +265,9 @@ class ClientListTest(unittest.TestCase):
self.clist.configure('''[{
"type": "sqlite3",
"params": {
"database_file": "''' + TESTDATA_PATH + '''example.org.sqlite3"
"database_file": "''' + TESTDATA_PATH + '''example.com.sqlite3"
},
"cache-zones" : ["example.org"],
"cache-zones" : ["example.com"],
"cache-type": "mapped",
"cache-enable": false
}]''', True)
......@@ -291,7 +291,7 @@ class ClientListTest(unittest.TestCase):
self.clist.configure('''[{
"type": "MasterFiles",
"params": {
"example.org": "''' + TESTDATA_PATH + '''example.org.zone"
"example.com": "''' + TESTDATA_PATH + '''example.com"
},
"cache-enable": true,
"cache-type": "mapped"
......
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