mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
commit
77e61974e6
3 changed files with 28 additions and 32 deletions
|
@ -37,14 +37,14 @@ module Fog
|
|||
def copy_db_snapshot(source_db_snapshot_identifier, target_db_snapshot_identifier, copy_tags = false)
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
snapshot_id = Fog::AWS::Mock.snapshot_id
|
||||
data = {
|
||||
'snapshotId' => snapshot_id,
|
||||
}
|
||||
snapshot_id = Fog::AWS::Mock.snapshot_id
|
||||
data = self.data[:snapshots]["#{source_db_snapshot_identifier}"]
|
||||
data['DBSnapshotIdentifier'] = snapshot_id
|
||||
self.data[:snapshots][snapshot_id] = data
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id
|
||||
}.merge!(data)
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'CopyDBSnapshotResult' => {'DBSnapshot' => data.dup}
|
||||
}
|
||||
response
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,25 +7,23 @@ Shindo.tests('Fog::Rds[:aws] | db snapshot requests', ['aws']) do
|
|||
'EngineVersion' => String,
|
||||
'InstanceCreateTime' => Time,
|
||||
'DBInstanceIdentifier' => String,
|
||||
'DBSnapshotIdentifier' => String,
|
||||
'Iops' => Fog::Nullable::Integer,
|
||||
'MasterUsername' => String,
|
||||
'Port' => Fog::Nullable::Integer,
|
||||
'Status' => String,
|
||||
'StorageType' => String,
|
||||
'SnapshotType' => String
|
||||
'SnapshotType' => String,
|
||||
'SnapshotCreateTime' => Fog::Nullable::Time,
|
||||
}
|
||||
|
||||
@snapshots_format = {
|
||||
'requestId' => String
|
||||
}
|
||||
|
||||
@snapshot_copy_result = {
|
||||
'requestId' => String,
|
||||
'snapshotId' => String
|
||||
}
|
||||
|
||||
@rds_identity = "test_rds"
|
||||
response = Fog::AWS[:rds].create_db_instance(@rds_identity,{
|
||||
|
||||
Fog::AWS[:rds].create_db_instance(@rds_identity,{
|
||||
"DBInstanceClass"=>"db.m3.xlarge",
|
||||
"Engine"=>"PostgreSQL",
|
||||
"AllocatedStorage"=>100,
|
||||
|
@ -36,30 +34,27 @@ Shindo.tests('Fog::Rds[:aws] | db snapshot requests', ['aws']) do
|
|||
@rds = Fog::AWS[:rds].servers.get(@rds_identity)
|
||||
|
||||
tests('success') do
|
||||
@snapshot_id = "testRdsSnapshot"
|
||||
tests("#create_snapshot(#{@rds.identity})").formats(@snapshot_format) do
|
||||
Fog::AWS[:rds].create_db_snapshot(@rds.identity,@snapshot_id).body["CreateDBSnapshotResult"]["DBSnapshot"]
|
||||
end
|
||||
@snapshot_id = "testRdsSnapshot"
|
||||
tests("#create_snapshot(#{@rds.identity})").formats(@snapshot_format) do
|
||||
Fog::AWS[:rds].create_db_snapshot(@rds.identity,@snapshot_id).body["CreateDBSnapshotResult"]["DBSnapshot"]
|
||||
end
|
||||
|
||||
Fog.wait_for { Fog::AWS[:rds].snapshots.get(@snapshot_id) }
|
||||
Fog::AWS[:rds].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
Fog.wait_for { Fog::AWS[:rds].snapshots.get(@snapshot_id) }
|
||||
Fog::AWS[:rds].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
|
||||
tests("#modify_db_snapshot_attribute").formats(@snapshots_format) do
|
||||
Fog::AWS[:rds].modify_db_snapshot_attribute(@snapshot_id, {"Add.MemberId"=>["389480430104"]}).body
|
||||
end
|
||||
tests("#modify_db_snapshot_attribute").formats(@snapshots_format) do
|
||||
Fog::AWS[:rds].modify_db_snapshot_attribute(@snapshot_id, {"Add.MemberId"=>["389480430104"]}).body
|
||||
end
|
||||
|
||||
tests("#copy_db_snapshot (#{@snapshot_id}, target_snapshot_id)").formats(@snapshot_copy_result) do
|
||||
data = Fog::AWS[:rds].copy_db_snapshot(@snapshot_id, "target_snapshot_id").body
|
||||
pp data.inspect
|
||||
data
|
||||
end
|
||||
tests("#copy_db_snapshot (#{@snapshot_id}, target_snapshot_id)").formats(@snapshot_format) do
|
||||
Fog::AWS[:rds].copy_db_snapshot(@snapshot_id, "target_snapshot_id").body["CopyDBSnapshotResult"]["DBSnapshot"]
|
||||
end
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
tests('failure') do
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::RDS::NotFound) do
|
||||
Fog::AWS[:rds].delete_db_snapshot(@rds.identity)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@rds.destroy
|
||||
|
|
|
@ -138,7 +138,7 @@ class AWS
|
|||
|
||||
SNAPSHOT = {
|
||||
'AllocatedStorage' => Integer,
|
||||
'AvailabilityZone' => String,
|
||||
'AvailabilityZone' => Fog::Nullable::String,
|
||||
'DBInstanceIdentifier' => String,
|
||||
'DBSnapshotIdentifier' => String,
|
||||
'EngineVersion' => String,
|
||||
|
@ -146,10 +146,11 @@ class AWS
|
|||
'InstanceCreateTime' => Time,
|
||||
'Iops' => Fog::Nullable::Integer,
|
||||
'MasterUsername' => String,
|
||||
'Port' => Integer,
|
||||
'Port' => Fog::Nullable::Integer,
|
||||
'SnapshotCreateTime' => Fog::Nullable::Time,
|
||||
'Status' => String,
|
||||
'SnapshotType' => String
|
||||
'SnapshotType' => String,
|
||||
'StorageType' => String,
|
||||
}
|
||||
|
||||
INSTANCE = {
|
||||
|
|
Loading…
Add table
Reference in a new issue