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
|
sec_group_set = self.data[:security_groups].values
|
||||||
end
|
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_set.each do |sec_group|
|
||||||
sec_group["IPRanges"].each do |iprange|
|
sec_group["IPRanges"].each do |iprange|
|
||||||
if iprange["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
if iprange["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
||||||
|
|
@ -54,6 +56,8 @@ module Fog
|
||||||
end
|
end
|
||||||
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|
|
sec_group["EC2SecurityGroups"].each do |ec2_secg|
|
||||||
if ec2_secg["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
if ec2_secg["Status"] == "authorizing" || iprange["Status"] == "revoking"
|
||||||
ec2_secg[:tmp] ||= Time.now + Fog::Mock.delay * 2
|
ec2_secg[:tmp] ||= Time.now + Fog::Mock.delay * 2
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ module Fog
|
||||||
|
|
||||||
if opts[:snapshot_id]
|
if opts[:snapshot_id]
|
||||||
snapshots = snapshots.select{|snapshot| snapshot['DBSnapshotIdentifier'] == 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
|
end
|
||||||
|
|
||||||
snapshots.each do |snapshot|
|
snapshots.each do |snapshot|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
||||||
group_name = 'fog-test'
|
group_name = 'fog-test'
|
||||||
params = {:id => group_name, :description => 'fog test'}
|
params = {:id => group_name, :description => 'fog test'}
|
||||||
|
|
||||||
pending if Fog.mocking?
|
model_tests(Fog::AWS[:rds].security_groups, params) do
|
||||||
model_tests(Fog::AWS[:rds].security_groups, params, false) do
|
|
||||||
|
|
||||||
tests("#description").returns('fog test') { @instance.description }
|
tests("#description").returns('fog test') { @instance.description }
|
||||||
|
|
||||||
|
|
@ -19,6 +18,8 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
||||||
@instance.wait_for { ready? }
|
@instance.wait_for { ready? }
|
||||||
|
|
||||||
tests("#revoke_ec2_security_group").succeeds do
|
tests("#revoke_ec2_security_group").succeeds do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
@instance.revoke_ec2_security_group(@ec2_sec_group.name)
|
@instance.revoke_ec2_security_group(@ec2_sec_group.name)
|
||||||
|
|
||||||
returns('revoking') do
|
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'] }
|
returns('authorizing') { @instance.ip_ranges.detect{|h| h['CIDRIP'] == @cidr}['Status'] }
|
||||||
end
|
end
|
||||||
|
|
||||||
@instance.wait_for { ready? }
|
|
||||||
tests("#revoke_cidrip").succeeds do
|
tests("#revoke_cidrip").succeeds do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
|
@instance.wait_for { ready? }
|
||||||
@instance.revoke_cidrip(@cidr)
|
@instance.revoke_cidrip(@cidr)
|
||||||
returns('revoking') { @instance.ip_ranges.detect{|h| h['CIDRIP'] == @cidr}['Status'] }
|
returns('revoking') { @instance.ip_ranges.detect{|h| h['CIDRIP'] == @cidr}['Status'] }
|
||||||
@instance.wait_for { ready? }
|
@instance.wait_for { ready? }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
Shindo.tests("AWS::RDS | security groups", ['aws', 'rds']) do
|
Shindo.tests("AWS::RDS | security groups", ['aws', 'rds']) do
|
||||||
params = {:id => 'fog-test', :description => 'fog test'}
|
params = {:id => 'fog-test', :description => 'fog test'}
|
||||||
|
|
||||||
pending if Fog.mocking?
|
collection_tests(Fog::AWS[:rds].security_groups, params)
|
||||||
collection_tests(Fog::AWS[:rds].security_groups, params, false)
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
||||||
|
|
||||||
pending if Fog.mocking?
|
model_tests(Fog::AWS[:rds].servers, rds_default_server_params) do
|
||||||
|
|
||||||
model_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
|
||||||
# We'll need this later; create it early to avoid waiting
|
# 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))
|
@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
|
end
|
||||||
|
|
||||||
tests("#modify").succeeds do
|
tests("#modify").succeeds do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
orig_parameter_group = @instance.db_parameter_groups.first['DBParameterGroupName']
|
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')
|
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? }
|
@instance.reload.wait_for { ready? }
|
||||||
|
|
||||||
tests('#create_read_replica').succeeds do
|
tests('#create_read_replica').succeeds do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
replica = @instance_with_final_snapshot.create_read_replica(uniq_id('fog-replica'))
|
replica = @instance_with_final_snapshot.create_read_replica(uniq_id('fog-replica'))
|
||||||
@instance_with_final_snapshot.reload
|
@instance_with_final_snapshot.reload
|
||||||
returns([replica.id]) { @instance_with_final_snapshot.read_replica_identifiers }
|
returns([replica.id]) { @instance_with_final_snapshot.read_replica_identifiers }
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
Shindo.tests("AWS::RDS | servers", ['aws', 'rds']) do
|
Shindo.tests("AWS::RDS | servers", ['aws', 'rds']) do
|
||||||
|
|
||||||
pending if Fog.mocking?
|
collection_tests(Fog::AWS[:rds].servers, rds_default_server_params) do
|
||||||
|
|
||||||
collection_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
|
||||||
@instance.wait_for { ready? }
|
@instance.wait_for { ready? }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
Shindo.tests("AWS::RDS | snapshot", ['aws', 'rds']) do
|
Shindo.tests("AWS::RDS | snapshot", ['aws', 'rds']) do
|
||||||
|
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||||
@server.wait_for { ready? }
|
@server.wait_for { ready? }
|
||||||
|
|
||||||
params = {:id => uniq_id, :instance_id => @server.id}
|
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? }
|
@instance.wait_for { ready? }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
Shindo.tests("AWS::RDS | snapshots", ['aws', 'rds']) do
|
Shindo.tests("AWS::RDS | snapshots", ['aws', 'rds']) do
|
||||||
|
|
||||||
pending if Fog.mocking?
|
|
||||||
|
|
||||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||||
@server.wait_for { ready? }
|
@server.wait_for { ready? }
|
||||||
|
|
||||||
params = {:id => uniq_id, :instance_id => @server.id}
|
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? }
|
@instance.wait_for { ready? }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue