def test_create_healthcheck(self): """ Tests retry behavior for create_healthcheck """ # Retryable error (max retries reached) conn = DummyConn( create_health_check=[self._retryable_error, self._retryable_error]) with patch.object(boto_route53, "_get_conn", MagicMock(return_value=conn)): result = boto_route53.create_healthcheck( "foo", error_retries=2, ) assert conn.create_health_check.call_count == 2 assert result is False # Retryable error (passes on 2nd attempt) conn = DummyConn(create_health_check=[self._retryable_error, True]) with patch.object(boto_route53, "_get_conn", MagicMock(return_value=conn)): result = boto_route53.create_healthcheck("foo") assert conn.create_health_check.call_count == 2 assert result == {"result": True}, result # Non-retryable error (should re-raise DNSServerError) conn = DummyConn(create_health_check=[self._fatal_error]) with patch.object(boto_route53, "_get_conn", MagicMock(return_value=conn)): result = boto_route53.create_healthcheck("foo") assert conn.create_health_check.call_count == 1 assert result == {"error": "There was an error"}, result
def test_create_healthcheck(self): """ tests that given a valid instance id and valid ELB that register_instances returns True. """ expected = { "result": { "CreateHealthCheckResponse": { "HealthCheck": { "HealthCheckConfig": { "FailureThreshold": "3", "IPAddress": "10.0.0.1", "ResourcePath": "/", "RequestInterval": "30", "Type": "HTTPS", "Port": "443", "FullyQualifiedDomainName": "blog.saltstack.furniture", }, "HealthCheckVersion": "1", }, }, }, } healthcheck = boto_route53.create_healthcheck( "10.0.0.1", fqdn="blog.saltstack.furniture", hc_type="HTTPS", port=443, resource_path="/", ) del healthcheck["result"]["CreateHealthCheckResponse"]["HealthCheck"][ "CallerReference" ] del healthcheck["result"]["CreateHealthCheckResponse"]["HealthCheck"]["Id"] self.assertEqual(healthcheck, expected)
def test_create_healthcheck(self): ''' tests that given a valid instance id and valid ELB that register_instances returns True. ''' expected = { 'result': { 'CreateHealthCheckResponse': { 'HealthCheck': { 'HealthCheckConfig': { 'FailureThreshold': '3', 'IPAddress': '10.0.0.1', 'ResourcePath': '/', 'RequestInterval': '30', 'Type': 'HTTPS', 'Port': '443', 'FullyQualifiedDomainName': 'blog.saltstack.furniture', }, 'HealthCheckVersion': '1', }, }, }, } healthcheck = boto_route53.create_healthcheck( '10.0.0.1', fqdn='blog.saltstack.furniture', hc_type='HTTPS', port=443, resource_path='/', ) del healthcheck['result']['CreateHealthCheckResponse']['HealthCheck'][ 'CallerReference'] del healthcheck['result']['CreateHealthCheckResponse']['HealthCheck'][ 'Id'] self.assertEqual(healthcheck, expected)