mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
compare endpoint_status in Azure profiles
This commit is contained in:
@@ -375,8 +375,11 @@ def _profile_is_match(have, desired):
|
||||
desired_endpoints = desired.endpoints
|
||||
endpoints = zip(have_endpoints, desired_endpoints)
|
||||
for have_endpoint, desired_endpoint in endpoints:
|
||||
have_status = have_endpoint.endpoint_status or 'Enabled'
|
||||
desired_status = desired_endpoint.endpoint_status or 'Enabled'
|
||||
if have_endpoint.name != desired_endpoint.name or \
|
||||
have_endpoint.type != desired_endpoint.type:
|
||||
have_endpoint.type != desired_endpoint.type or \
|
||||
have_status != desired_status:
|
||||
return false(have_endpoint, desired_endpoint, have.name)
|
||||
target_type = have_endpoint.type.split('/')[-1]
|
||||
if target_type == 'externalEndpoints':
|
||||
|
||||
@@ -473,6 +473,7 @@ class Test_ProfileIsMatch(TestCase):
|
||||
endpoints = 1,
|
||||
endpoint_name = 'name',
|
||||
endpoint_type = 'profile/nestedEndpoints',
|
||||
endpoint_status = None,
|
||||
target = 'target.unit.tests',
|
||||
target_id = 'resource/id',
|
||||
geos = ['GEO-AF'],
|
||||
@@ -490,6 +491,7 @@ class Test_ProfileIsMatch(TestCase):
|
||||
endpoints=[Endpoint(
|
||||
name=endpoint_name,
|
||||
type=endpoint_type,
|
||||
endpoint_status=endpoint_status,
|
||||
target=target,
|
||||
target_resource_id=target_id,
|
||||
geo_mapping=geos,
|
||||
@@ -506,6 +508,9 @@ class Test_ProfileIsMatch(TestCase):
|
||||
self.assertFalse(is_match(profile(), profile(monitor_proto='HTTP')))
|
||||
self.assertFalse(is_match(profile(), profile(endpoint_name='a')))
|
||||
self.assertFalse(is_match(profile(), profile(endpoint_type='b')))
|
||||
self.assertFalse(
|
||||
is_match(profile(), profile(endpoint_status='Disabled'))
|
||||
)
|
||||
self.assertFalse(
|
||||
is_match(profile(endpoint_type='b'), profile(endpoint_type='b'))
|
||||
)
|
||||
@@ -1760,7 +1765,7 @@ class TestAzureDnsProvider(TestCase):
|
||||
self.assertEqual(profiles[0].endpoints[0].endpoint_status, 'Disabled')
|
||||
self.assertEqual(profiles[1].endpoints[0].endpoint_status, 'Disabled')
|
||||
|
||||
# # test that same record gets populated back from traffic managers
|
||||
# test that same record gets populated back from traffic managers
|
||||
tm_list = provider._tm_client.profiles.list_by_resource_group
|
||||
tm_list.return_value = profiles
|
||||
azrecord = RecordSet(
|
||||
@@ -1772,7 +1777,8 @@ class TestAzureDnsProvider(TestCase):
|
||||
record2 = provider._populate_record(zone, azrecord)
|
||||
self.assertEqual(record1.dynamic._data(), record2.dynamic._data())
|
||||
|
||||
# _process_desired_zone shouldn't change anything when not needed
|
||||
# _process_desired_zone shouldn't change anything when status value is
|
||||
# supported
|
||||
zone1 = Zone(zone.name, sub_zones=[])
|
||||
zone1.add_record(record1)
|
||||
zone2 = provider._process_desired_zone(zone1.copy())
|
||||
|
||||
Reference in New Issue
Block a user