1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/brightbox/requests/compute/database_snapsnot_tests.rb

48 lines
1.8 KiB
Ruby
Raw Normal View History

Shindo.tests('Fog::Compute[:brightbox] | database snapshot requests', ['brightbox']) do
pending if Fog.mocking?
service = Fog::Compute[:brightbox]
tests('success') do
# Create a Database Server, then snapshot it
database_server = service.database_servers.create
database_server.wait_for { ready? }
service.snapshot_database_server(database_server.id)
tests("#list_database_snapshots") do
result = service.list_database_snapshots
data_matches_schema(Brightbox::Compute::Formats::Collection::DATABASE_SNAPSHOTS, {:allow_extra_keys => true}) { result }
@database_snapshot_id = result.last["id"]
end
# Can't delete the server until snapshot is finished
service.database_snapshots.get(@database_snapshot_id).wait_for { ready? }
database_server.destroy
tests("#get_database_snapshot('#{@database_snapshot_id}')") do
result = service.get_database_snapshot(@database_snapshot_id)
data_matches_schema(Brightbox::Compute::Formats::Full::DATABASE_SNAPSHOT, {:allow_extra_keys => true}) { result }
end
update_options = {
:name => "New name"
}
tests("#update_database_snapshot('#{@database_snapshot_id}', update_options)") do
result = service.update_database_snapshot(@database_snapshot_id, update_options)
data_matches_schema(Brightbox::Compute::Formats::Full::DATABASE_SNAPSHOT, {:allow_extra_keys => true}) { result }
end
tests("#destroy_database_snapshot('#{@database_snapshot_id}')") do
result = service.destroy_database_snapshot(@database_snapshot_id)
data_matches_schema(Brightbox::Compute::Formats::Full::DATABASE_SNAPSHOT, {:allow_extra_keys => true}) { result }
end
end
tests('failure') do
tests("get_database_snapshot").raises(Excon::Errors::NotFound) do
service.get_database_snapshot("dbs-00000")
end
end
end