mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|elb] make describe_load_balancers parse SSLCertificateId. Verify with test.
This commit is contained in:
parent
b0473e2725
commit
5bb96b7d12
2 changed files with 19 additions and 1 deletions
|
@ -75,7 +75,7 @@ module Fog
|
|||
@in_listeners = false
|
||||
when 'PolicyNames'
|
||||
@in_policy_names = false
|
||||
when 'Protocol'
|
||||
when 'Protocol', 'SSLCertificateId'
|
||||
@listener_description['Listener'][name] = value
|
||||
when 'LoadBalancerPort', 'InstancePort'
|
||||
@listener_description['Listener'][name] = value.to_i
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
||||
@load_balancer_id = 'fog-test-elb'
|
||||
@key_name = 'fog-test'
|
||||
|
||||
tests('success') do
|
||||
@certificate = AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
|
||||
tests("#create_load_balancer").formats(AWS::ELB::Formats::CREATE_LOAD_BALANCER) do
|
||||
zones = ['us-east-1a']
|
||||
listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}]
|
||||
|
@ -16,6 +19,19 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
raises(Fog::AWS::ELB::NotFound) { AWS[:elb].describe_load_balancers('none-such-lb') }
|
||||
end
|
||||
|
||||
tests("#describe_load_balancers with SSL listener") do
|
||||
sleep 5 unless Fog.mocking?
|
||||
listeners = [
|
||||
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
|
||||
]
|
||||
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners)
|
||||
response = AWS[:elb].describe_load_balancers(@load_balancer_id).body
|
||||
tests("SSLCertificateId is set").returns(@certificate['Arn']) do
|
||||
listeners = response["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first["ListenerDescriptions"]
|
||||
listeners.find {|l| l["Listener"]["Protocol"] == 'HTTPS' }["Listener"]["SSLCertificateId"]
|
||||
end
|
||||
end
|
||||
|
||||
tests("#configure_health_check").formats(AWS::ELB::Formats::CONFIGURE_HEALTH_CHECK) do
|
||||
health_check = {
|
||||
'Target' => 'HTTP:80/index.html',
|
||||
|
@ -39,5 +55,7 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
tests("#delete_load_balancer when already deleted").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
end
|
||||
|
||||
AWS[:iam].delete_server_certificate(@key_name)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue