Fix issue when subzone is a non-dotted endswith for zone

This commit is contained in:
Ross McFarland
2022-08-11 09:10:56 -07:00
parent af010121ea
commit 18ee70ddb5
2 changed files with 15 additions and 3 deletions
+4 -3
View File
@@ -315,12 +315,13 @@ class Manager(object):
while zones:
# Grab the one we'lre going to work on now
zone = zones.pop()
trimmer = len(zone) + 1
dotted = f'.{zone}'
trimmer = len(dotted)
subs = set()
# look at all the zone names that come after it
for candidate in zones:
# If they end with this zone's name them they're a sub
if candidate.endswith(zone):
# If they end with this zone's dotted name, it's a sub
if candidate.endswith(dotted):
# We want subs to exclude the zone portion
subs.add(candidate[:-trimmer])
+11
View File
@@ -776,6 +776,17 @@ class TestManager(TestCase):
set(), manager.configured_sub_zones('skipped.alevel.unit2.tests.')
)
# zones that end with names of others
manager.config['zones'] = {
'unit.tests.': {},
'uunit.tests.': {},
'uuunit.tests.': {},
}
manager._configured_sub_zones = None
self.assertEqual(set(), manager.configured_sub_zones('unit.tests.'))
self.assertEqual(set(), manager.configured_sub_zones('uunit.tests.'))
self.assertEqual(set(), manager.configured_sub_zones('uuunit.tests.'))
class TestMainThreadExecutor(TestCase):
def test_success(self):