Make each alias zone reference its target zone instead of listing all

aliases zones in the target zone configuration
This commit is contained in:
Jonathan Leroy
2020-10-20 22:18:48 +02:00
parent 7bf0b31367
commit f2a6f870b4
6 changed files with 87 additions and 12 deletions
+19
View File
@@ -0,0 +1,19 @@
manager:
max_workers: 2
providers:
in:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
zones:
unit.tests.:
sources:
- in
targets:
- dump
alias.tests.:
alias: unit.tests.
+13
View File
@@ -0,0 +1,13 @@
manager:
max_workers: 2
providers:
in:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
zones:
unit.tests.:
alias: unit-source.tests.
+17 -2
View File
@@ -298,7 +298,8 @@ class TestManager(TestCase):
pass
# This should be ok, we'll fall back to not passing it
manager._populate_and_plan('unit.tests.', [NoLenient()], [])
manager._populate_and_plan('unit.tests.', None, False,
[NoLenient()], [])
class NoZone(SimpleProvider):
@@ -307,7 +308,21 @@ class TestManager(TestCase):
# This will blow up, we don't fallback for source
with self.assertRaises(TypeError):
manager._populate_and_plan('unit.tests.', [NoZone()], [])
manager._populate_and_plan('unit.tests.', None, False,
[NoZone()], [])
def test_alias_zones(self):
with TemporaryDirectory() as tmpdir:
environ['YAML_TMP_DIR'] = tmpdir.dirname
Manager(get_config_filename('simple-alias-zone.yaml')) \
.validate_configs()
with self.assertRaises(ManagerException) as ctx:
Manager(get_config_filename('unknown-source-zone.yaml')) \
.validate_configs()
self.assertTrue('Invalid alias zone' in
text_type(ctx.exception))
class TestMainThreadExecutor(TestCase):