1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Add test to validate non-dotted subdomain zones are vaild

This confirms that in addition to the recently added support for dotted
subdomains that subdomains that are not dotted are supported.  From
RFC1034 Section 3.5 this would be a <subdomain> that contains a single
<label> without <subdomain> recurring.
This commit is contained in:
Sachi King
2022-06-27 10:56:20 +10:00
parent d5363e8045
commit 04be906c3c
3 changed files with 17 additions and 11 deletions

View File

@ -167,6 +167,11 @@ sub.txt:
values:
- ns1.test.
- ns2.test.
subzone:
type: 'NS'
values:
- 192.0.2.1.
- 192.0.2.8.
txt:
ttl: 600
type: TXT

View File

@ -121,12 +121,12 @@ class TestManager(TestCase):
environ['YAML_TMP_DIR'] = tmpdir.dirname
tc = Manager(get_config_filename('simple.yaml')) \
.sync(dry_run=False)
self.assertEqual(27, tc)
self.assertEqual(28, tc)
# try with just one of the zones
tc = Manager(get_config_filename('simple.yaml')) \
.sync(dry_run=False, eligible_zones=['unit.tests.'])
self.assertEqual(21, tc)
self.assertEqual(22, tc)
# the subzone, with 2 targets
tc = Manager(get_config_filename('simple.yaml')) \
@ -141,18 +141,18 @@ class TestManager(TestCase):
# Again with force
tc = Manager(get_config_filename('simple.yaml')) \
.sync(dry_run=False, force=True)
self.assertEqual(27, tc)
self.assertEqual(28, tc)
# Again with max_workers = 1
tc = Manager(get_config_filename('simple.yaml'), max_workers=1) \
.sync(dry_run=False, force=True)
self.assertEqual(27, tc)
self.assertEqual(28, tc)
# Include meta
tc = Manager(get_config_filename('simple.yaml'), max_workers=1,
include_meta=True) \
.sync(dry_run=False, force=True)
self.assertEqual(32, tc)
self.assertEqual(33, tc)
def test_eligible_sources(self):
with TemporaryDirectory() as tmpdir:
@ -220,13 +220,13 @@ class TestManager(TestCase):
# compare doesn't use _process_desired_zone and thus doesn't filter
# out root NS records, that seems fine/desirable
changes = manager.compare(['in'], ['dump'], 'unit.tests.')
self.assertEqual(22, len(changes))
self.assertEqual(23, len(changes))
# Compound sources with varying support
changes = manager.compare(['in', 'nosshfp'],
['dump'],
'unit.tests.')
self.assertEqual(21, len(changes))
self.assertEqual(22, len(changes))
with self.assertRaises(ManagerException) as ctx:
manager.compare(['nope'], ['dump'], 'unit.tests.')

View File

@ -34,7 +34,7 @@ class TestYamlProvider(TestCase):
# without it we see everything
source.populate(zone)
self.assertEqual(24, len(zone.records))
self.assertEqual(25, len(zone.records))
source.populate(dynamic_zone)
self.assertEqual(6, len(dynamic_zone.records))
@ -57,12 +57,12 @@ class TestYamlProvider(TestCase):
# We add everything
plan = target.plan(zone)
self.assertEqual(21, len([c for c in plan.changes
self.assertEqual(22, len([c for c in plan.changes
if isinstance(c, Create)]))
self.assertFalse(isfile(yaml_file))
# Now actually do it
self.assertEqual(21, target.apply(plan))
self.assertEqual(22, target.apply(plan))
self.assertTrue(isfile(yaml_file))
# Dynamic plan
@ -90,7 +90,7 @@ class TestYamlProvider(TestCase):
# A 2nd sync should still create everything
plan = target.plan(zone)
self.assertEqual(21, len([c for c in plan.changes
self.assertEqual(22, len([c for c in plan.changes
if isinstance(c, Create)]))
with open(yaml_file) as fh:
@ -112,6 +112,7 @@ class TestYamlProvider(TestCase):
self.assertTrue('values' in data.pop('loc'))
self.assertTrue('values' in data.pop('urlfwd'))
self.assertTrue('values' in data.pop('sub.txt'))
self.assertTrue('values' in data.pop('subzone'))
# these are stored as singular 'value'
self.assertTrue('value' in data.pop('_imap._tcp'))
self.assertTrue('value' in data.pop('_pop3._tcp'))