1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|elasticache] Fix bug in AWS::Elasticache::Cluster.get

This commit is contained in:
Benton Roberts 2011-09-08 12:04:07 -04:00 committed by geemus
parent a6a6c3eb4b
commit a4c8d83260
3 changed files with 12 additions and 30 deletions

View file

@ -16,9 +16,9 @@ module Fog
def get(identity) def get(identity)
new( new(
connection.describe_cache_security_groups( connection.describe_cache_clusters(
'CacheSecurityGroupName' => identity 'CacheClusterId' => identity
).body['CacheSecurityGroups'].first ).body['CacheClusters'].first
) )
rescue Fog::AWS::Elasticache::NotFound rescue Fog::AWS::Elasticache::NotFound
nil nil

View file

@ -10,29 +10,17 @@ Shindo.tests('AWS::Elasticache | cache clusters', ['aws', 'elasticache']) do
pending if Fog.mocking? pending if Fog.mocking?
model_tests(AWS[:elasticache].clusters, cluster_params, false) do model_tests(AWS[:elasticache].clusters, cluster_params, false) do
# Reload to get the cluster info @instance.reload # Reload to get the cluster info from AWS
@instance.reload puts "Waiting for #{@instance.id} to become available (#{@instance.status})..."
puts "Waiting for cluster #{@instance.id} to become available..." @instance.wait_for {ready?}
#@instance.wait_for {ready?} # This doesn't work (entity disappears)
while (@instance.status != "available") do
puts "Waiting for cluster #{@instance.id} (#{@instance.status})"
sleep 20
#@instance.reload # This doesn't work either! (no changes)
@instance = AWS[:elasticache].clusters.find {|c| c.id == @instance.id}
end
end end
# Single model is still deleting, so re-randomize the cluster ID
cluster_params[:id] = "fog-test-cluster-#{rand(999).to_s}"
collection_tests(AWS[:elasticache].clusters, cluster_params, false) do collection_tests(AWS[:elasticache].clusters, cluster_params, false) do
# Reload to get the cluster info @instance.reload # Reload to get the cluster info from AWS
@instance.reload puts "Waiting for #{@instance.id} to become available (#{@instance.status})..."
puts "Waiting for cluster #{@instance.id} to become available..." @instance.wait_for {ready?}
#@instance.wait_for {ready?} # This doesn't work (entity disappears)
while (@instance.status != "available") do
puts "Waiting for cluster #{@instance.id} (#{@instance.status})"
sleep 20
#@instance.reload # This doesn't work either! (no changes)
@instance = AWS[:elasticache].clusters.find {|c| c.id == @instance.id}
end
end end
end end

View file

@ -49,13 +49,7 @@ Shindo.tests('AWS::Elasticache | cache cluster requests', ['aws', 'elasticache']
puts "Waiting for cluster #{cluster_id} to become available..." puts "Waiting for cluster #{cluster_id} to become available..."
cluster = AWS[:elasticache].clusters.find {|c| c.id == cluster_id} cluster = AWS[:elasticache].clusters.find {|c| c.id == cluster_id}
#cluster.wait_for {ready?} # This doesn't work (entity disappears) cluster.wait_for {ready?} # This doesn't work (entity disappears)
while (cluster.status != "available") do
puts "Waiting for cluster #{cluster.id} (#{cluster.status})"
sleep 20
#cluster.reload # This doesn't work either! (no changes)
cluster = AWS[:elasticache].clusters.find {|c| c.id == cluster_id}
end
tests( tests(
'#delete_cache_security_group' '#delete_cache_security_group'