determine if instances are InService across a given load balancer and array of load balancers

This commit is contained in:
Anuj Biyani
2013-05-31 18:20:09 -07:00
parent 20b59fb132
commit 9273f748c2
4 changed files with 105 additions and 0 deletions

11
spec/support/fake_ec2.rb Normal file
View File

@@ -0,0 +1,11 @@
module AWS
class FakeEC2
def initialize
end
class Instance
def initialize
end
end
end
end

37
spec/support/fake_elb.rb Normal file
View File

@@ -0,0 +1,37 @@
module AWS
class FakeELB
def initialize
end
class LoadBalancer
def initialize(name, options = {})
end
def instances
@instances ||= InstanceCollection.new
end
end
class InstanceCollection
def initialize
end
def health
@health ||= [
{
instance: AWS::FakeEC2::Instance.new,
description: 'N/A',
state: 'InService',
reason_code: 'N/A'
},
{
instance: AWS::FakeEC2::Instance.new,
description: 'Instance has failed at least the UnhealthyThreshold number of health checks consecutively.',
state: 'OutOfService',
reason_code: 'Instance'
}
]
end
end
end
end