diff --git a/moto/elb/exceptions.py b/moto/elb/exceptions.py index e2707b60a..33b3f20cc 100644 --- a/moto/elb/exceptions.py +++ b/moto/elb/exceptions.py @@ -27,3 +27,11 @@ class TooManyTagsError(ELBClientError): super(TooManyTagsError, self).__init__( "LoadBalancerNotFound", "The quota for the number of tags that can be assigned to a load balancer has been reached") + + +class BadHealthCheckDefinition(ELBClientError): + def __init__(self): + super(BadHealthCheckDefinition, self).__init__( + "ValidationError", + "HealthCheck Target must begin with one of HTTP, TCP, HTTPS, SSL") + diff --git a/moto/elb/models.py b/moto/elb/models.py index 2303e907c..8954f5e3c 100644 --- a/moto/elb/models.py +++ b/moto/elb/models.py @@ -10,7 +10,7 @@ from boto.ec2.elb.attributes import ( ) from boto.ec2.elb.policies import Policies from moto.core import BaseBackend -from .exceptions import LoadBalancerNotFoundError, TooManyTagsError +from .exceptions import LoadBalancerNotFoundError, TooManyTagsError, BadHealthCheckDefinition class FakeHealthCheck(object): @@ -21,6 +21,8 @@ class FakeHealthCheck(object): self.unhealthy_threshold = unhealthy_threshold self.interval = interval self.target = target + if not target.startswith(('HTTP', 'TCP', 'HTTPS', 'SSL')): + raise BadHealthCheckDefinition class FakeListener(object):