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:
@@ -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,
|
||||
|
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user