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

Fix Manager ordering assumptions

This commit is contained in:
Ross McFarland
2019-10-07 08:41:28 -07:00
parent 0708b797da
commit db8de8acb8
3 changed files with 33 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
providers:
yaml:
class: octodns.provider.yaml.YamlProvider
directory: ./config
simple_source:
class: helpers.SimpleSource
zones:
missing.sources.:
targets:
- yaml
missing.targets.:
sources:
- yaml
unknown.source.:
sources:
- not-there
targets:
- yaml
unknown.target.:
sources:
- yaml
targets:
- not-there-either
not.targetable.:
sources:
- yaml
targets:
- simple_source

View File

@@ -5,24 +5,8 @@ providers:
simple_source: simple_source:
class: helpers.SimpleSource class: helpers.SimpleSource
zones: zones:
missing.sources.:
targets:
- yaml
missing.targets.:
sources:
- yaml
unknown.source.: unknown.source.:
sources: sources:
- not-there - not-there
targets: targets:
- yaml - yaml
unknown.target.:
sources:
- yaml
targets:
- not-there-either
not.targetable.:
sources:
- yaml
targets:
- simple_source

View File

@@ -62,25 +62,25 @@ class TestManager(TestCase):
def test_missing_source(self): def test_missing_source(self):
with self.assertRaises(Exception) as ctx: with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \ Manager(get_config_filename('provider-problems.yaml')) \
.sync(['missing.sources.']) .sync(['missing.sources.'])
self.assertTrue('missing sources' in text_type(ctx.exception)) self.assertTrue('missing sources' in text_type(ctx.exception))
def test_missing_targets(self): def test_missing_targets(self):
with self.assertRaises(Exception) as ctx: with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \ Manager(get_config_filename('provider-problems.yaml')) \
.sync(['missing.targets.']) .sync(['missing.targets.'])
self.assertTrue('missing targets' in text_type(ctx.exception)) self.assertTrue('missing targets' in text_type(ctx.exception))
def test_unknown_source(self): def test_unknown_source(self):
with self.assertRaises(Exception) as ctx: with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \ Manager(get_config_filename('provider-problems.yaml')) \
.sync(['unknown.source.']) .sync(['unknown.source.'])
self.assertTrue('unknown source' in text_type(ctx.exception)) self.assertTrue('unknown source' in text_type(ctx.exception))
def test_unknown_target(self): def test_unknown_target(self):
with self.assertRaises(Exception) as ctx: with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \ Manager(get_config_filename('provider-problems.yaml')) \
.sync(['unknown.target.']) .sync(['unknown.target.'])
self.assertTrue('unknown target' in text_type(ctx.exception)) self.assertTrue('unknown target' in text_type(ctx.exception))
@@ -99,7 +99,7 @@ class TestManager(TestCase):
def test_source_only_as_a_target(self): def test_source_only_as_a_target(self):
with self.assertRaises(Exception) as ctx: with self.assertRaises(Exception) as ctx:
Manager(get_config_filename('unknown-provider.yaml')) \ Manager(get_config_filename('provider-problems.yaml')) \
.sync(['not.targetable.']) .sync(['not.targetable.'])
self.assertTrue('does not support targeting' in self.assertTrue('does not support targeting' in
text_type(ctx.exception)) text_type(ctx.exception))