Parcourir la source

[2833] use example.com zone for tests using in-memory data source (cache)

instead of the "static" BIND zone.  there's no difference between these two
any more, so this is just a matter of style.
JINMEI Tatuya il y a 12 ans
Parent
commit
ec52d37b45

+ 10 - 16
src/lib/python/isc/datasrc/tests/datasrc_test.py

@@ -33,11 +33,11 @@ WRITE_ZONE_DB_FILE = TESTDATA_WRITE_PATH + "rwtest.sqlite3.copied"
 
 READ_ZONE_DB_CONFIG = "{ \"database_file\": \"" + READ_ZONE_DB_FILE + "\" }"
 WRITE_ZONE_DB_CONFIG = "{ \"database_file\": \"" + WRITE_ZONE_DB_FILE + "\"}"
-# Static zone must be built from client list.
-STATIC_ZONE_CONFIG = '''[{
+# In-memory data source must be built via client list.
+INMEMORY_ZONE_CONFIG = '''[{
    "type": "MasterFiles",
    "cache-enable": true,
-   "params": {"BIND": "''' + TESTDATA_PATH + 'static.zone"}}]'
+   "params": {"example.com": "''' + TESTDATA_PATH + 'example.com"}}]'
 
 def add_rrset(rrset_list, name, rrclass, rrtype, ttl, rdatas):
     rrset_to_add = isc.dns.RRset(name, rrclass, rrtype, ttl)
@@ -566,13 +566,10 @@ class DataSrcUpdater(unittest.TestCase):
         self.assertEqual(updater_refs, sys.getrefcount(updater))
 
     def test_two_modules(self):
-        # load two modules, and check if they don't interfere; as the
-        # memory datasource module no longer exists, we check the static
-        # datasource instead (as that uses the memory datasource
-        # anyway).
-        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.CH)
-        clist.configure(STATIC_ZONE_CONFIG, True)
-        dsc_static = clist.find(isc.dns.Name("bind"), True, False)[0]
+        # load two modules, and check if they don't interfere.
+        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
+        clist.configure(INMEMORY_ZONE_CONFIG, True)
+        dsc_static = clist.find(isc.dns.Name("example.com"), True, False)[0]
         dsc_sql = isc.datasrc.DataSourceClient("sqlite3", READ_ZONE_DB_CONFIG)
 
         # check if exceptions are working
@@ -729,12 +726,9 @@ class DataSrcUpdater(unittest.TestCase):
         self.assertTrue(dsc.delete_zone(zone_name))
 
     def test_create_zone_not_implemented(self):
-        # As the memory datasource module no longer exists, we check the
-        # static datasource instead (as that uses the memory datasource
-        # anyway).
-        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.CH)
-        clist.configure(STATIC_ZONE_CONFIG, True)
-        dsc = clist.find(isc.dns.Name("bind"), True, False)[0]
+        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
+        clist.configure(INMEMORY_ZONE_CONFIG, True)
+        dsc = clist.find(isc.dns.Name("example.com"), True, False)[0]
         self.assertRaises(isc.datasrc.NotImplemented, dsc.create_zone,
                           isc.dns.Name("example.com"))
 

+ 8 - 13
src/lib/python/isc/datasrc/tests/zone_loader_test.py

@@ -34,11 +34,11 @@ ORIG_DB_FILE = TESTDATA_PATH + '/example.com.sqlite3'
 DB_FILE = TESTDATA_WRITE_PATH + '/zoneloadertest.sqlite3'
 DB_CLIENT_CONFIG = '{ "database_file": "' + DB_FILE + '" }'
 DB_SOURCE_CLIENT_CONFIG = '{ "database_file": "' + SOURCE_DB_FILE + '" }'
-# Static zone must be built from client list.
-STATIC_ZONE_CONFIG = '''[{
+# In-memory data source must be built via client list.
+INMEMORY_ZONE_CONFIG = '''[{
    "type": "MasterFiles",
    "cache-enable": true,
-   "params": {"BIND": "''' + TESTDATA_PATH + '/static.zone"}}]'
+   "params": {"example.com": "''' + TESTDATA_PATH + '/example.com"}}]'
 
 ORIG_SOA_TXT = 'example.com. 3600 IN SOA master.example.com. ' +\
                'admin.example.com. 1234 3600 1800 2419200 7200\n'
@@ -220,16 +220,11 @@ class ZoneLoaderTests(unittest.TestCase):
                           self.client, zone_name, self.source_client)
 
     def test_no_ds_load_support(self):
-        # As the memory datasource module no longer exists, we check the
-        # static datasource instead (as that uses the memory datasource
-        # anyway).
-        #
-        # This may change in the future, but ATM, the static ds does not
-        # support the API the zone loader uses (it has direct load
-        # calls).
-        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.CH)
-        clist.configure(STATIC_ZONE_CONFIG, True)
-        inmem_client = clist.find(isc.dns.Name("bind"), True, False)[0]
+        # This may change in the future, but ATM, in-memory ds does not
+        # support the API the zone loader uses.
+        clist = isc.datasrc.ConfigurableClientList(isc.dns.RRClass.IN)
+        clist.configure(INMEMORY_ZONE_CONFIG, True)
+        inmem_client = clist.find(isc.dns.Name("example.com"), True, False)[0]
         self.assertRaises(isc.datasrc.NotImplemented,
                           isc.datasrc.ZoneLoader,
                           inmem_client, self.test_name, self.test_file)