diff --git a/lib/fog/aws/requests/rds/describe_db_security_groups.rb b/lib/fog/aws/requests/rds/describe_db_security_groups.rb index c82c67c59..4a3b3996c 100644 --- a/lib/fog/aws/requests/rds/describe_db_security_groups.rb +++ b/lib/fog/aws/requests/rds/describe_db_security_groups.rb @@ -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 diff --git a/lib/fog/aws/requests/rds/describe_db_snapshots.rb b/lib/fog/aws/requests/rds/describe_db_snapshots.rb index e1538fac8..a3c6d4320 100644 --- a/lib/fog/aws/requests/rds/describe_db_snapshots.rb +++ b/lib/fog/aws/requests/rds/describe_db_snapshots.rb @@ -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| diff --git a/tests/aws/models/rds/security_group_tests.rb b/tests/aws/models/rds/security_group_tests.rb index 800e81447..821a5ba75 100644 --- a/tests/aws/models/rds/security_group_tests.rb +++ b/tests/aws/models/rds/security_group_tests.rb @@ -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? } diff --git a/tests/aws/models/rds/security_groups_tests.rb b/tests/aws/models/rds/security_groups_tests.rb index 9fdff32da..22f06fee4 100644 --- a/tests/aws/models/rds/security_groups_tests.rb +++ b/tests/aws/models/rds/security_groups_tests.rb @@ -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 diff --git a/tests/aws/models/rds/server_tests.rb b/tests/aws/models/rds/server_tests.rb index 62d07d530..5cc70e14a 100644 --- a/tests/aws/models/rds/server_tests.rb +++ b/tests/aws/models/rds/server_tests.rb @@ -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 } diff --git a/tests/aws/models/rds/servers_tests.rb b/tests/aws/models/rds/servers_tests.rb index fa03194da..454e305bf 100644 --- a/tests/aws/models/rds/servers_tests.rb +++ b/tests/aws/models/rds/servers_tests.rb @@ -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 diff --git a/tests/aws/models/rds/snapshot_tests.rb b/tests/aws/models/rds/snapshot_tests.rb index 09de659e2..262c4536e 100644 --- a/tests/aws/models/rds/snapshot_tests.rb +++ b/tests/aws/models/rds/snapshot_tests.rb @@ -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 diff --git a/tests/aws/models/rds/snapshots_tests.rb b/tests/aws/models/rds/snapshots_tests.rb index af6efbe3b..10ac42f07 100644 --- a/tests/aws/models/rds/snapshots_tests.rb +++ b/tests/aws/models/rds/snapshots_tests.rb @@ -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