|
@@ -20,6 +20,7 @@ import isc.dns
|
|
|
import unittest
|
|
|
import os
|
|
|
import shutil
|
|
|
+import sys
|
|
|
import json
|
|
|
|
|
|
TESTDATA_PATH = os.environ['TESTDATA_PATH'] + os.sep
|
|
@@ -494,6 +495,23 @@ class DataSrcUpdater(unittest.TestCase):
|
|
|
dsc.get_updater(isc.dns.Name("notexistent.example"),
|
|
|
True))
|
|
|
|
|
|
+ def test_client_reference(self):
|
|
|
+ # Temporarily create various objects using factory methods of the
|
|
|
+ # client. The created objects won't be stored anywhere and
|
|
|
+ # immediately released. The creation shouldn't affect the reference
|
|
|
+ # to the base client.
|
|
|
+ dsc = isc.datasrc.DataSourceClient("sqlite3", WRITE_ZONE_DB_CONFIG)
|
|
|
+ orig_ref = sys.getrefcount(dsc)
|
|
|
+
|
|
|
+ dsc.find_zone(isc.dns.Name("example.com"))
|
|
|
+ self.assertEqual(orig_ref, sys.getrefcount(dsc))
|
|
|
+
|
|
|
+ dsc.get_iterator(isc.dns.Name("example.com."))
|
|
|
+ self.assertEqual(orig_ref, sys.getrefcount(dsc))
|
|
|
+
|
|
|
+ dsc.get_updater(isc.dns.Name("example.com"), True)
|
|
|
+ self.assertEqual(orig_ref, sys.getrefcount(dsc))
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
isc.log.init("bind10")
|
|
|
unittest.main()
|