mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
configure_health_check and create_app_cookie_stickiness_policy
This commit is contained in:
parent
46c2ef983a
commit
be496d4b71
3 changed files with 47 additions and 2 deletions
|
@ -36,6 +36,30 @@ module Fog
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
def configure_health_check(lb_name, health_check)
|
||||
if load_balancer = self.data[:load_balancers][lb_name]
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
load_balancer['HealthCheck'] = health_check
|
||||
|
||||
response.body = {
|
||||
'ResponseMetadata' => {
|
||||
'RequestId' => Fog::AWS::Mock.request_id
|
||||
},
|
||||
'ConfigureHealthCheckResult' => {
|
||||
'HealthCheck' => load_balancer['HealthCheck']
|
||||
}
|
||||
}
|
||||
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::ELB::NotFound
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,6 +28,27 @@ module Fog
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
def create_app_cookie_stickiness_policy(lb_name, policy_name, cookie_name)
|
||||
if load_balancer = self.data[:load_balancers][lb_name]
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
load_balancer['Policies']['AppCookieStickinessPolicies'] << { 'CookieName' => cookie_name, 'PolicyName' => policy_name }
|
||||
|
||||
response.body = {
|
||||
'ResponseMetadata' => {
|
||||
'RequestId' => Fog::AWS::Mock.request_id
|
||||
}
|
||||
}
|
||||
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::ELB::NotFound
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,8 +16,6 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
raises(Fog::AWS::ELB::NotFound) { AWS[:elb].describe_load_balancers('none-such-lb') }
|
||||
end
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
tests("#configure_health_check").formats(AWS::ELB::Formats::CONFIGURE_HEALTH_CHECK) do
|
||||
health_check = {
|
||||
'Target' => 'HTTP:80/index.html',
|
||||
|
@ -35,6 +33,8 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
AWS[:elb].create_app_cookie_stickiness_policy(@load_balancer_id, policy, cookie).body
|
||||
end
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
tests("#create_lb_cookie_stickiness_policy with expiry").formats(AWS::ELB::Formats::BASIC) do
|
||||
policy = 'fog-lb-expiry'
|
||||
expiry = 300
|
||||
|
|
Loading…
Add table
Reference in a new issue