Browse Source

Provider.strict_supports=True by default, fix tests that didn't like that

pull/957/head
Ross McFarland 3 years ago
parent
commit
723db157ab
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
8 changed files with 29 additions and 4 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +1
    -1
      octodns/provider/base.py
  3. +2
    -0
      tests/config/always-dry-run.yaml
  4. +2
    -0
      tests/config/processors.yaml
  5. +2
    -0
      tests/config/simple-alias-zone.yaml
  6. +3
    -0
      tests/config/simple.yaml
  7. +4
    -0
      tests/test_octodns_provider_base.py
  8. +12
    -3
      tests/test_octodns_provider_yaml.py

+ 3
- 0
CHANGELOG.md View File

@ -2,6 +2,9 @@
#### Noteworthy changes
* Provider.strict_supports defaults to true, can be returned to the old
behavior by setting strict_supports=False in your provider params.
#### Stuff
* Added simple IgnoreRootNsFilter


+ 1
- 1
octodns/provider/base.py View File

@ -15,7 +15,7 @@ class BaseProvider(BaseSource):
apply_disabled=False,
update_pcent_threshold=Plan.MAX_SAFE_UPDATE_PCENT,
delete_pcent_threshold=Plan.MAX_SAFE_DELETE_PCENT,
strict_supports=False,
strict_supports=True,
):
super().__init__(id)
self.log.debug(


+ 2
- 0
tests/config/always-dry-run.yaml View File

@ -2,10 +2,12 @@ providers:
in:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
strict_supports: False
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
supports_root_ns: False
strict_supports: False
zones:
unit.tests.:
always-dry-run: true


+ 2
- 0
tests/config/processors.yaml View File

@ -7,10 +7,12 @@ providers:
# This helps us get coverage when printing out provider versions
class: helpers.TestYamlProvider
directory: tests/config
strict_supports: False
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
supports_root_ns: False
strict_supports: False
geo:
class: helpers.GeoProvider
nosshfp:


+ 2
- 0
tests/config/simple-alias-zone.yaml View File

@ -4,10 +4,12 @@ providers:
in:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
strict_supports: False
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
supports_root_ns: False
strict_supports: False
zones:
unit.tests.:
sources:


+ 3
- 0
tests/config/simple.yaml View File

@ -5,17 +5,20 @@ providers:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
supports_root_ns: False
strict_supports: False
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
default_ttl: 999
supports_root_ns: False
strict_supports: False
# This is sort of ugly, but it shouldn't hurt anything. It'll just write out
# the target file twice where it and dump are both used
dump2:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR2
supports_root_ns: False
strict_supports: False
simple:
class: helpers.SimpleProvider
geo:


+ 4
- 0
tests/test_octodns_provider_base.py View File

@ -715,6 +715,7 @@ class TestBaseProviderSupportsRootNs(TestCase):
def test_supports_root_ns_false_matches(self):
# provider has a matching existing root record
provider = self.Provider(self.has_root)
provider.strict_supports = False
provider.SUPPORTS_ROOT_NS = False
# matching root NS in the desired
@ -737,6 +738,7 @@ class TestBaseProviderSupportsRootNs(TestCase):
def test_supports_root_ns_false_different(self):
# provider has a non-matching existing record
provider = self.Provider(self.different_root)
provider.strict_supports = False
provider.SUPPORTS_ROOT_NS = False
# different root is in the desired
@ -760,6 +762,7 @@ class TestBaseProviderSupportsRootNs(TestCase):
def test_supports_root_ns_false_missing(self):
# provider has an existing record
provider = self.Provider(self.has_root)
provider.strict_supports = False
provider.SUPPORTS_ROOT_NS = False
# desired doesn't have a root
@ -778,6 +781,7 @@ class TestBaseProviderSupportsRootNs(TestCase):
def test_supports_root_ns_false_create_zone(self):
# provider has no existing records (create)
provider = self.Provider()
provider.strict_supports = False
provider.SUPPORTS_ROOT_NS = False
# case where we have a root NS in the desired


+ 12
- 3
tests/test_octodns_provider_yaml.py View File

@ -54,7 +54,9 @@ class TestYamlProvider(TestCase):
directory = join(td.dirname, 'sub', 'dir')
yaml_file = join(directory, 'unit.tests.yaml')
dynamic_yaml_file = join(directory, 'dynamic.tests.yaml')
target = YamlProvider('test', directory, supports_root_ns=False)
target = YamlProvider(
'test', directory, supports_root_ns=False, strict_supports=False
)
# We add everything
plan = target.plan(zone)
@ -343,7 +345,10 @@ class TestSplitYamlProvider(TestCase):
def test_provider(self):
source = SplitYamlProvider(
'test', join(dirname(__file__), 'config/split'), extension='.tst'
'test',
join(dirname(__file__), 'config/split'),
extension='.tst',
strict_supports=False,
)
zone = Zone('unit.tests.', [])
@ -366,7 +371,11 @@ class TestSplitYamlProvider(TestCase):
zone_dir = join(directory, 'unit.tests.tst')
dynamic_zone_dir = join(directory, 'dynamic.tests.tst')
target = SplitYamlProvider(
'test', directory, extension='.tst', supports_root_ns=False
'test',
directory,
extension='.tst',
supports_root_ns=False,
strict_supports=False,
)
# We add everything


Loading…
Cancel
Save