|
@@ -63,7 +63,7 @@ def check_for_rrset(expected_rrsets, rrset):
|
|
|
|
|
|
class DataSrcClient(unittest.TestCase):
|
|
|
|
|
|
- def test_constructors(self):
|
|
|
+ def test_(self):
|
|
|
# can't construct directly
|
|
|
self.assertRaises(TypeError, isc.datasrc.ZoneIterator)
|
|
|
|
|
@@ -87,7 +87,7 @@ class DataSrcClient(unittest.TestCase):
|
|
|
|
|
|
# for RRSIGS, the TTL's are currently modified. This test should
|
|
|
# start failing when we fix that.
|
|
|
- rrs = dsc.get_iterator(isc.dns.Name("sql1.example.com."))
|
|
|
+ rrs = dsc.get_iterator(isc.dns.Name("sql1.example.com."), True)
|
|
|
|
|
|
# we do not know the order in which they are returned by the iterator
|
|
|
# but we do want to check them, so we put all records into one list
|
|
@@ -114,7 +114,10 @@ class DataSrcClient(unittest.TestCase):
|
|
|
"256 3 5 AwEAAdYdRhBAEY67R/8G1N5AjGF6asIiNh/pNGeQ8xDQP13J"+
|
|
|
"N2lo+sNqWcmpYNhuVqRbLB+mamsU1XcCICSBvAlSmfz/ZUdafX23knAr"+
|
|
|
"TlALxMmspcfdpqun3Yr3YYnztuj06rV7RqmveYckWvAUXVYMSMQZfJ30"+
|
|
|
- "5fs0dE/xLztL/CzZ",
|
|
|
+ "5fs0dE/xLztL/CzZ"
|
|
|
+ ])
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.DNSKEY(), isc.dns.RRTTL(3600), [
|
|
|
"257 3 5 AwEAAbaKDSa9XEFTsjSYpUTHRotTS9Tz3krfDucugW5UokGQ"+
|
|
|
"KC26QlyHXlPTZkC+aRFUs/dicJX2kopndLcnlNAPWiKnKtrsFSCnIJDB"+
|
|
|
"ZIyvcKq+9RXmV3HK3bUdHnQZ88IZWBRmWKfZ6wnzHo53kdYKAemTErkz"+
|
|
@@ -127,7 +130,15 @@ class DataSrcClient(unittest.TestCase):
|
|
|
isc.dns.RRType.NS(), isc.dns.RRTTL(3600),
|
|
|
[
|
|
|
"dns01.example.com.",
|
|
|
+ ])
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.NS(), isc.dns.RRTTL(3600),
|
|
|
+ [
|
|
|
"dns02.example.com.",
|
|
|
+ ])
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.NS(), isc.dns.RRTTL(3600),
|
|
|
+ [
|
|
|
"dns03.example.com."
|
|
|
])
|
|
|
add_rrset(expected_rrset_list, name, rrclass,
|
|
@@ -137,9 +148,19 @@ class DataSrcClient(unittest.TestCase):
|
|
|
])
|
|
|
# For RRSIGS, we can't add the fake data through the API, so we
|
|
|
# simply pass no rdata at all (which is skipped by the check later)
|
|
|
+ # Since we passed individual_rrs = True to get_iterator, each RRSIG
|
|
|
+ # will be returned as a separate RRset, so add them all one at a time
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.RRSIG(), isc.dns.RRTTL(3600), None)
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.RRSIG(), isc.dns.RRTTL(3600), None)
|
|
|
add_rrset(expected_rrset_list, name, rrclass,
|
|
|
isc.dns.RRType.RRSIG(), isc.dns.RRTTL(3600), None)
|
|
|
add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.RRSIG(), isc.dns.RRTTL(3600), None)
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.RRSIG(), isc.dns.RRTTL(7200), None)
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
isc.dns.RRType.SOA(), isc.dns.RRTTL(3600),
|
|
|
[
|
|
|
"master.example.com. admin.example.com. 678 3600 1800 2419200 7200"
|
|
@@ -158,6 +179,8 @@ class DataSrcClient(unittest.TestCase):
|
|
|
])
|
|
|
add_rrset(expected_rrset_list, name, rrclass,
|
|
|
isc.dns.RRType.RRSIG(), isc.dns.RRTTL(3600), None)
|
|
|
+ add_rrset(expected_rrset_list, name, rrclass,
|
|
|
+ isc.dns.RRType.RRSIG(), isc.dns.RRTTL(7200), None)
|
|
|
|
|
|
# rrs is an iterator, but also has direct get_next_rrset(), use
|
|
|
# the latter one here
|
|
@@ -179,10 +202,26 @@ class DataSrcClient(unittest.TestCase):
|
|
|
# instead of failing?
|
|
|
self.assertRaises(isc.datasrc.Error, rrs.get_next_rrset)
|
|
|
|
|
|
+ # Without an individual_rrs argument, it should return 55 RRsets
|
|
|
+ dsc = isc.datasrc.DataSourceClient("sqlite3", READ_ZONE_DB_CONFIG)
|
|
|
rrets = dsc.get_iterator(isc.dns.Name("example.com"))
|
|
|
# there are more than 80 RRs in this zone... let's just count them
|
|
|
# (already did a full check of the smaller zone above)
|
|
|
self.assertEqual(55, len(list(rrets)))
|
|
|
+
|
|
|
+ # same test, but now with explicit False argument for individual_rrs
|
|
|
+ dsc = isc.datasrc.DataSourceClient("sqlite3", READ_ZONE_DB_CONFIG)
|
|
|
+ rrets = dsc.get_iterator(isc.dns.Name("example.com"), False)
|
|
|
+ # there are more than 80 RRs in this zone... let's just count them
|
|
|
+ # (already did a full check of the smaller zone above)
|
|
|
+ self.assertEqual(55, len(list(rrets)))
|
|
|
+
|
|
|
+ # Count should be 84 if we request individual records
|
|
|
+ dsc = isc.datasrc.DataSourceClient("sqlite3", READ_ZONE_DB_CONFIG)
|
|
|
+ rrets = dsc.get_iterator(isc.dns.Name("example.com"), True)
|
|
|
+ # there are more than 80 RRs in this zone... let's just count them
|
|
|
+ # (already did a full check of the smaller zone above)
|
|
|
+ self.assertEqual(84, len(list(rrets)))
|
|
|
# TODO should we catch this (iterating past end) and just return None
|
|
|
# instead of failing?
|
|
|
self.assertRaises(isc.datasrc.Error, rrs.get_next_rrset)
|