Browse Source

Remove duplicative sort and add a more robust test.

pull/1161/head
Ross McFarland 2 years ago
parent
commit
16a6bb4f8a
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
2 changed files with 18 additions and 1 deletions
  1. +1
    -1
      octodns/processor/arpa.py
  2. +17
    -0
      tests/test_octodns_processor_arpa.py

+ 1
- 1
octodns/processor/arpa.py View File

@ -51,8 +51,8 @@ class AutoArpa(BaseProcessor):
return desired
def _order_and_unique_fqdns(self, fqdns, max_auto_arpa):
fqdns = sorted(fqdns)
seen = set()
# order the fqdns making a copy so we can reset the list below
ordered = sorted(fqdns)
fqdns = []
for _, fqdn in ordered:


+ 17
- 0
tests/test_octodns_processor_arpa.py View File

@ -281,6 +281,23 @@ class TestAutoArpa(TestCase):
aa._order_and_unique_fqdns(duplicate_values, max_auto_arpa=999),
)
duplicate_values = [
(50, 'd.unit.tests.'),
(999, 'dup.unit.tests.'),
(3, 'a.unit.tests.'),
(1, 'dup.unit.tests.'),
(2, 'c.unit.tests.'),
]
self.assertEqual(
[
'dup.unit.tests.',
'c.unit.tests.',
'a.unit.tests.',
'd.unit.tests.',
],
aa._order_and_unique_fqdns(duplicate_values, max_auto_arpa=999),
)
duplicate_values_2 = [(999, 'a.unit.tests.'), (999, 'a.unit.tests.')]
self.assertEqual(
['a.unit.tests.'],


Loading…
Cancel
Save