1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Correct DB Snapshot tests

This commit is contained in:
Jack Thomas 2016-07-13 11:22:52 +01:00
parent 12e5618a91
commit 6ee77804b0

View file

@ -7,25 +7,23 @@ Shindo.tests('Fog::Rds[:aws] | db snapshot requests', ['aws']) do
'EngineVersion' => String, 'EngineVersion' => String,
'InstanceCreateTime' => Time, 'InstanceCreateTime' => Time,
'DBInstanceIdentifier' => String, 'DBInstanceIdentifier' => String,
'DBSnapshotIdentifier' => String,
'Iops' => Fog::Nullable::Integer, 'Iops' => Fog::Nullable::Integer,
'MasterUsername' => String, 'MasterUsername' => String,
'Port' => Fog::Nullable::Integer, 'Port' => Fog::Nullable::Integer,
'Status' => String, 'Status' => String,
'StorageType' => String, 'StorageType' => String,
'SnapshotType' => String 'SnapshotType' => String,
'SnapshotCreateTime' => Fog::Nullable::Time,
} }
@snapshots_format = { @snapshots_format = {
'requestId' => String 'requestId' => String
} }
@snapshot_copy_result = {
'requestId' => String,
'snapshotId' => String
}
@rds_identity = "test_rds" @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", "DBInstanceClass"=>"db.m3.xlarge",
"Engine"=>"PostgreSQL", "Engine"=>"PostgreSQL",
"AllocatedStorage"=>100, "AllocatedStorage"=>100,
@ -36,30 +34,27 @@ Shindo.tests('Fog::Rds[:aws] | db snapshot requests', ['aws']) do
@rds = Fog::AWS[:rds].servers.get(@rds_identity) @rds = Fog::AWS[:rds].servers.get(@rds_identity)
tests('success') do tests('success') do
@snapshot_id = "testRdsSnapshot" @snapshot_id = "testRdsSnapshot"
tests("#create_snapshot(#{@rds.identity})").formats(@snapshot_format) do tests("#create_snapshot(#{@rds.identity})").formats(@snapshot_format) do
Fog::AWS[:rds].create_db_snapshot(@rds.identity,@snapshot_id).body["CreateDBSnapshotResult"]["DBSnapshot"] Fog::AWS[:rds].create_db_snapshot(@rds.identity,@snapshot_id).body["CreateDBSnapshotResult"]["DBSnapshot"]
end end
Fog.wait_for { Fog::AWS[:rds].snapshots.get(@snapshot_id) } Fog.wait_for { Fog::AWS[:rds].snapshots.get(@snapshot_id) }
Fog::AWS[:rds].snapshots.get(@snapshot_id).wait_for { ready? } Fog::AWS[:rds].snapshots.get(@snapshot_id).wait_for { ready? }
tests("#modify_db_snapshot_attribute").formats(@snapshots_format) do tests("#modify_db_snapshot_attribute").formats(@snapshots_format) do
Fog::AWS[:rds].modify_db_snapshot_attribute(@snapshot_id, {"Add.MemberId"=>["389480430104"]}).body Fog::AWS[:rds].modify_db_snapshot_attribute(@snapshot_id, {"Add.MemberId"=>["389480430104"]}).body
end end
tests("#copy_db_snapshot (#{@snapshot_id}, target_snapshot_id)").formats(@snapshot_copy_result) do tests("#copy_db_snapshot (#{@snapshot_id}, target_snapshot_id)").formats(@snapshot_format) do
data = Fog::AWS[:rds].copy_db_snapshot(@snapshot_id, "target_snapshot_id").body Fog::AWS[:rds].copy_db_snapshot(@snapshot_id, "target_snapshot_id").body["CopyDBSnapshotResult"]["DBSnapshot"]
pp data.inspect end
data
end
end end
tests('failure') do
tests('failure') do
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::RDS::NotFound) do tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::RDS::NotFound) do
Fog::AWS[:rds].delete_db_snapshot(@rds.identity) Fog::AWS[:rds].delete_db_snapshot(@rds.identity)
end end
end end
@rds.destroy @rds.destroy