1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Throw exception on invalid route53 interval option value

This commit is contained in:
Jörg Runkel
2019-03-04 17:10:29 +01:00
parent 72a389e835
commit 07b7f1e8ef
2 changed files with 23 additions and 2 deletions

View File

@@ -553,8 +553,12 @@ class Route53Provider(BaseProvider):
def _healthcheck_request_interval(self, record):
interval = record._octodns.get('route53', {}) \
.get('healthcheck', {}) \
.get('request_interval')
return interval if (interval in [10, 30]) else 10
.get('request_interval', 10)
if (interval in [10, 30]):
return interval
else:
raise Exception('route53.healthcheck.request_interval '
'parameter must be either 10 or 30.')
def _health_check_equivilent(self, host, path, protocol, port,
measure_latency, request_interval,

View File

@@ -930,6 +930,23 @@ class TestRoute53Provider(TestCase):
self.assertFalse(latency)
self.assertEquals(30, interval)
record_invalid = Record.new(self.expected, 'a', {
'ttl': 61,
'type': 'A',
'value': '1.2.3.4',
'octodns': {
'healthcheck': {
},
'route53': {
'healthcheck': {
'request_interval': 20,
}
}
}
})
with self.assertRaises(Exception):
interval = provider._healthcheck_request_interval(record_invalid)
def test_create_health_checks_provider_options(self):
provider, stubber = self._get_stubbed_provider()