1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/ibm/models/storage/volume_tests.rb

61 lines
1.6 KiB
Ruby
Raw Normal View History

Shindo.tests('Fog::Storage[:ibm] | volume', ['ibm']) do
2011-12-02 10:27:44 -08:00
tests('success') do
2012-02-13 10:51:03 -05:00
2011-12-02 10:27:44 -08:00
@volume = nil
@volume_id = nil
2012-02-13 10:51:03 -05:00
@name = "fog test volume"
@format = "RAW"
2012-02-28 23:51:37 -05:00
@location_id = "41"
2011-12-02 10:27:44 -08:00
@size = "256"
@offering_id = "20001208"
2012-02-13 10:51:03 -05:00
tests('Fog::Storage::IBM::Volume.new') do
@volume = Fog::Storage[:ibm].volumes.new(
2011-12-02 10:27:44 -08:00
:name => @name,
:format => @format,
2011-12-02 10:27:44 -08:00
:location_id => @location_id,
:size => @size,
:offering_id => @offering_id
)
returns(@name) { @volume.name }
end
2012-02-13 10:51:03 -05:00
tests('Fog::Storage::IBM::Volume#save') do
2011-12-02 10:27:44 -08:00
returns(true) { @volume.save }
returns(String) { @volume.id.class }
@volume.wait_for(Fog::IBM.timeout) { ready? }
2011-12-02 10:27:44 -08:00
@volume_id = @volume.id
end
2012-02-13 10:51:03 -05:00
tests("Fog::Storage::IBM::Volume#instance") do
2011-12-02 10:27:44 -08:00
returns(nil) { @volume.instance }
end
tests("Fog::Storage::IBM::Volume#location_id") do
returns(String) { @volume.location_id.class }
2011-12-02 10:27:44 -08:00
end
2012-02-13 10:51:03 -05:00
tests('Fog::Storage::IBM::Volume#id') do
2011-12-02 10:27:44 -08:00
returns(@volume_id) { @volume.id }
end
tests('Fog::Storage::IBM::Volume#ready?') do
2011-12-02 10:27:44 -08:00
# We do a "get" to advance the state if we are mocked.
# TODO: Fix this for real connections
Fog::Storage[:ibm].get_volume(@volume_id)
2011-12-02 10:27:44 -08:00
returns(true) { @volume.ready? }
end
tests('Fog::Storage::IBM::Volume#state') do
returns("Detached") { @volume.state }
2011-12-02 10:27:44 -08:00
end
tests('Fog::Storage::IBM::Volume#destroy') do
2011-12-02 10:27:44 -08:00
returns(true) { @volume.destroy }
end
2012-02-13 10:51:03 -05:00
2011-12-02 10:27:44 -08:00
end
2012-02-13 10:51:03 -05:00
end