diff --git a/octodns/processor/arpa.py b/octodns/processor/arpa.py index 3b98761..bd56ec9 100644 --- a/octodns/processor/arpa.py +++ b/octodns/processor/arpa.py @@ -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: diff --git a/tests/test_octodns_processor_arpa.py b/tests/test_octodns_processor_arpa.py index ccdb70f..328d05f 100644 --- a/tests/test_octodns_processor_arpa.py +++ b/tests/test_octodns_processor_arpa.py @@ -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.'],