mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|rds] Enabled model tests that pass when mocking
This commit is contained in:
parent
a0675f146f
commit
cb34e08a1d
8 changed files with 20 additions and 17 deletions
|
@ -42,6 +42,8 @@ module Fog
|
|||
sec_group_set = self.data[:security_groups].values
|
||||
end
|
||||
|
||||
# TODO: refactor to not delete items that we're iterating over. Causes
|
||||
# model tests to fail (currently pending)
|
||||
sec_group_set.each do |sec_group|
|
||||
sec_group["IPRanges"].each do |iprange|
|
||||
if iprange["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
||||
|
@ -54,6 +56,8 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
# TODO: refactor to not delete items that we're iterating over. Causes
|
||||
# model tests to fail (currently pending)
|
||||
sec_group["EC2SecurityGroups"].each do |ec2_secg|
|
||||
if ec2_secg["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
||||
ec2_secg[:tmp] ||= Time.now + Fog::Mock.delay * 2
|
||||
|
|
|
@ -41,6 +41,7 @@ module Fog
|
|||
|
||||
if opts[:snapshot_id]
|
||||
snapshots = snapshots.select{|snapshot| snapshot['DBSnapshotIdentifier'] == opts[:snapshot_id]}
|
||||
raise Fog::AWS::RDS::NotFound.new("DBSnapshot #{opts[:snapshot_id]} not found") if snapshots.empty?
|
||||
end
|
||||
|
||||
snapshots.each do |snapshot|
|
||||
|
|
|
@ -2,8 +2,7 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
|||
group_name = 'fog-test'
|
||||
params = {:id => group_name, :description => 'fog test'}
|
||||
|
||||
pending if Fog.mocking?
|
||||
model_tests(Fog::AWS[:rds].security_groups, params, false) do
|
||||
model_tests(Fog::AWS[:rds].security_groups, params) do
|
||||
|
||||
tests("#description").returns('fog test') { @instance.description }
|
||||
|
||||
|
@ -19,6 +18,8 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
|||
@instance.wait_for { ready? }
|
||||
|
||||
tests("#revoke_ec2_security_group").succeeds do
|
||||
pending if Fog.mocking?
|
||||
|
||||
@instance.revoke_ec2_security_group(@ec2_sec_group.name)
|
||||
|
||||
returns('revoking') do
|
||||
|
@ -37,8 +38,10 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
|||
returns('authorizing') { @instance.ip_ranges.detect{|h| h['CIDRIP'] == @cidr}['Status'] }
|
||||
end
|
||||
|
||||
@instance.wait_for { ready? }
|
||||
tests("#revoke_cidrip").succeeds do
|
||||
pending if Fog.mocking?
|
||||
|
||||
@instance.wait_for { ready? }
|
||||
@instance.revoke_cidrip(@cidr)
|
||||
returns('revoking') { @instance.ip_ranges.detect{|h| h['CIDRIP'] == @cidr}['Status'] }
|
||||
@instance.wait_for { ready? }
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
Shindo.tests("AWS::RDS | security groups", ['aws', 'rds']) do
|
||||
params = {:id => 'fog-test', :description => 'fog test'}
|
||||
|
||||
pending if Fog.mocking?
|
||||
collection_tests(Fog::AWS[:rds].security_groups, params, false)
|
||||
collection_tests(Fog::AWS[:rds].security_groups, params)
|
||||
end
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
model_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
||||
model_tests(Fog::AWS[:rds].servers, rds_default_server_params) do
|
||||
# We'll need this later; create it early to avoid waiting
|
||||
@instance_with_final_snapshot = Fog::AWS[:rds].servers.create(rds_default_server_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1))
|
||||
|
||||
|
@ -25,6 +23,8 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|||
end
|
||||
|
||||
tests("#modify").succeeds do
|
||||
pending if Fog.mocking?
|
||||
|
||||
orig_parameter_group = @instance.db_parameter_groups.first['DBParameterGroupName']
|
||||
parameter_group = Fog::AWS[:rds].parameter_groups.create(:id => uniq_id, :family => 'mysql5.1', :description => 'fog-test')
|
||||
|
||||
|
@ -77,6 +77,8 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|||
@instance.reload.wait_for { ready? }
|
||||
|
||||
tests('#create_read_replica').succeeds do
|
||||
pending if Fog.mocking?
|
||||
|
||||
replica = @instance_with_final_snapshot.create_read_replica(uniq_id('fog-replica'))
|
||||
@instance_with_final_snapshot.reload
|
||||
returns([replica.id]) { @instance_with_final_snapshot.read_replica_identifiers }
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
Shindo.tests("AWS::RDS | servers", ['aws', 'rds']) do
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
collection_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
||||
collection_tests(Fog::AWS[:rds].servers, rds_default_server_params) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
Shindo.tests("AWS::RDS | snapshot", ['aws', 'rds']) do
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server.wait_for { ready? }
|
||||
|
||||
params = {:id => uniq_id, :instance_id => @server.id}
|
||||
model_tests(Fog::AWS[:rds].snapshots, params, false) do
|
||||
model_tests(Fog::AWS[:rds].snapshots, params) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
Shindo.tests("AWS::RDS | snapshots", ['aws', 'rds']) do
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server.wait_for { ready? }
|
||||
|
||||
params = {:id => uniq_id, :instance_id => @server.id}
|
||||
collection_tests(Fog::AWS[:rds].snapshots, params, false) do
|
||||
collection_tests(Fog::AWS[:rds].snapshots, params) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue