2015-01-02 12:34:40 -05:00
|
|
|
Shindo.tests('AWS::Elasticache | security groups', ['aws', 'elasticache']) do
|
2014-12-30 17:25:09 -05:00
|
|
|
group_name = 'fog-test'
|
|
|
|
description = 'Fog Test'
|
|
|
|
|
|
|
|
pending if Fog.mocking?
|
|
|
|
|
|
|
|
model_tests(
|
2015-01-02 12:34:40 -05:00
|
|
|
Fog::AWS[:elasticache].security_groups,
|
2014-12-30 17:25:09 -05:00
|
|
|
{:id => group_name, :description => description}, false
|
|
|
|
) do
|
|
|
|
|
|
|
|
# An EC2 group to authorize
|
2015-01-02 12:34:40 -05:00
|
|
|
ec2_group = Fog::Compute.new(:provider => 'AWS').security_groups.create(
|
2014-12-30 17:25:09 -05:00
|
|
|
:name => 'fog-test-elasticache', :description => 'fog test'
|
|
|
|
)
|
|
|
|
|
|
|
|
# Reload to get the instance owner_id
|
|
|
|
@instance.reload
|
|
|
|
|
|
|
|
tests('#authorize_ec2_group') do
|
|
|
|
@instance.authorize_ec2_group(ec2_group.name)
|
|
|
|
returns('authorizing') do
|
|
|
|
group = @instance.ec2_groups.find do |g|
|
|
|
|
g['EC2SecurityGroupName'] == ec2_group.name
|
|
|
|
end
|
|
|
|
group['Status']
|
|
|
|
end
|
|
|
|
returns(false, 'not ready') { @instance.ready? }
|
|
|
|
end
|
|
|
|
|
|
|
|
@instance.wait_for { ready? }
|
|
|
|
|
|
|
|
tests('#revoke_ec2_group') do
|
|
|
|
@instance.revoke_ec2_group(ec2_group.name)
|
|
|
|
returns('revoking') do
|
|
|
|
group = @instance.ec2_groups.find do |g|
|
|
|
|
g['EC2SecurityGroupName'] == ec2_group.name
|
|
|
|
end
|
|
|
|
group['Status']
|
|
|
|
end
|
|
|
|
returns(false, 'not ready') { @instance.ready? }
|
|
|
|
end
|
|
|
|
|
|
|
|
ec2_group.destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
collection_tests(
|
2015-01-02 12:34:40 -05:00
|
|
|
Fog::AWS[:elasticache].security_groups,
|
2014-12-30 17:25:09 -05:00
|
|
|
{:id => group_name, :description => description}, false
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|