mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
TCP healthcheck support for Route53
This commit is contained in:
@@ -1046,8 +1046,11 @@ class Route53Provider(BaseProvider):
|
||||
# No value so give this a None to match value's
|
||||
config_ip_address = None
|
||||
|
||||
return host == config['FullyQualifiedDomainName'] and \
|
||||
path == config['ResourcePath'] and protocol == config['Type'] \
|
||||
fully_qualified_domain_name = config.get('FullyQualifiedDomainName',
|
||||
None)
|
||||
resource_path = config.get('ResourcePath', None)
|
||||
return host == fully_qualified_domain_name and \
|
||||
path == resource_path and protocol == config['Type'] \
|
||||
and port == config['Port'] and \
|
||||
measure_latency == config['MeasureLatency'] and \
|
||||
value == config_ip_address
|
||||
@@ -1103,13 +1106,14 @@ class Route53Provider(BaseProvider):
|
||||
config = {
|
||||
'EnableSNI': healthcheck_protocol == 'HTTPS',
|
||||
'FailureThreshold': 6,
|
||||
'FullyQualifiedDomainName': healthcheck_host,
|
||||
'MeasureLatency': healthcheck_latency,
|
||||
'Port': healthcheck_port,
|
||||
'RequestInterval': 10,
|
||||
'ResourcePath': healthcheck_path,
|
||||
'Type': healthcheck_protocol,
|
||||
}
|
||||
if healthcheck_protocol != 'TCP':
|
||||
config['FullyQualifiedDomainName'] = healthcheck_host
|
||||
config['ResourcePath'] = healthcheck_path
|
||||
if value:
|
||||
config['IPAddress'] = value
|
||||
|
||||
|
||||
@@ -1213,6 +1213,35 @@ class TestRoute53Provider(TestCase):
|
||||
self.assertEquals('42', id)
|
||||
stubber.assert_no_pending_responses()
|
||||
|
||||
# TCP health check
|
||||
|
||||
health_check_config = {
|
||||
'EnableSNI': False,
|
||||
'FailureThreshold': 6,
|
||||
'MeasureLatency': True,
|
||||
'Port': 8080,
|
||||
'RequestInterval': 10,
|
||||
'Type': 'TCP'
|
||||
}
|
||||
stubber.add_response('create_health_check', {
|
||||
'HealthCheck': {
|
||||
'Id': '42',
|
||||
'CallerReference': self.caller_ref,
|
||||
'HealthCheckConfig': health_check_config,
|
||||
'HealthCheckVersion': 1,
|
||||
},
|
||||
'Location': 'http://url',
|
||||
}, {
|
||||
'CallerReference': ANY,
|
||||
'HealthCheckConfig': health_check_config,
|
||||
})
|
||||
stubber.add_response('change_tags_for_resource', {})
|
||||
|
||||
record._octodns['healthcheck']['protocol'] = 'TCP'
|
||||
id = provider.get_health_check_id(record, 'target-1.unit.tests.', True)
|
||||
self.assertEquals('42', id)
|
||||
stubber.assert_no_pending_responses()
|
||||
|
||||
def test_health_check_measure_latency(self):
|
||||
provider, stubber = self._get_stubbed_provider()
|
||||
record_true = Record.new(self.expected, 'a', {
|
||||
|
||||
Reference in New Issue
Block a user