2012-04-29 12:59:24 -04:00
|
|
|
Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do
|
|
|
|
|
|
|
|
@image_format = {
|
2012-07-15 06:23:49 -04:00
|
|
|
'drive' => String,
|
2012-04-29 12:59:24 -04:00
|
|
|
'name' => String,
|
|
|
|
'user' => String,
|
|
|
|
'size' => Integer,
|
2012-04-29 15:50:17 -04:00
|
|
|
'claimed' => Fog::Nullable::String,
|
2012-04-29 12:59:24 -04:00
|
|
|
'status' => String,
|
2012-04-29 15:50:17 -04:00
|
|
|
'encryption:cipher' => String,
|
|
|
|
'read:bytes' => String,
|
|
|
|
'write:bytes' => String,
|
|
|
|
'read:requests' => String,
|
|
|
|
'write:requests' => String
|
2012-04-29 12:59:24 -04:00
|
|
|
}
|
2012-04-29 15:50:17 -04:00
|
|
|
|
2012-04-29 12:59:24 -04:00
|
|
|
tests('success') do
|
|
|
|
|
2012-07-16 15:01:21 -04:00
|
|
|
attributes = { 'name' => 'Test', 'size' => '24234567890' }
|
2012-04-29 12:59:24 -04:00
|
|
|
|
|
|
|
tests("#create_image").formats(@image_format) do
|
2012-04-29 15:50:17 -04:00
|
|
|
@image = Fog::Compute[:serverlove].create_image(attributes).body
|
2012-04-29 12:59:24 -04:00
|
|
|
end
|
|
|
|
|
2012-04-29 15:50:17 -04:00
|
|
|
tests("#list_images").succeeds do
|
2012-04-29 12:59:24 -04:00
|
|
|
Fog::Compute[:serverlove].images
|
|
|
|
end
|
2012-04-29 15:50:17 -04:00
|
|
|
|
2012-04-29 16:38:46 -04:00
|
|
|
tests("#update_image").returns(true) do
|
|
|
|
@image['name'] = "Diff"
|
|
|
|
Fog::Compute[:serverlove].update_image(@image['drive'], { name: @image['name'], size: @image['size']})
|
|
|
|
Fog::Compute[:serverlove].images.get(@image['drive']).name == "Diff"
|
|
|
|
end
|
|
|
|
|
2012-06-22 11:26:11 -04:00
|
|
|
tests("#load_standard_image").returns(true) do
|
Added loading of standard image.
Currently not working:
Expected(204) <=> Actual(404 Not Found)
request => {:connect_timeout=>60, :headers=>{"Authorization"=>"Basic YWE4ZWIxYzktYzc4OC00MDlmLWJmZjQtYjAyMjVjMDE0MDQ1OkFkZ1hYSGVUTmY3TTJHR1l2NEI3WkpnWE1ISkJMY1E2dlJBejRZUUg=", "Accept"=>"application/json", "Host"=>"api.z1-man.serverlove.com:443", "Content-Length"=>0}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/seanhandley/.rvm/gems/ruby-1.9.3-p125@fog_gem/gems/excon-0.14.1/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"api.z1-man.serverlove.com", :path=>"/drives/aea15650-5001-4cb8-8146-8c9835f5b880/image/679f5f44-0be7-4745-a658-cccd4334c1aa", :port=>"443", :query=>nil, :scheme=>"https", :method=>"post", :expects=>204}
response => #<Excon::Response:0x007ff661811848 @body="Operation failed: drive not found\n", @headers={"Server"=>"BaseHTTP/0.3 Python/2.6.6", "Date"=>"Fri, 22 Jun 2012 15:03:50 GMT", "X-Elastic-Error"=>"missing drive", "Connection"=>"close", "Content-Type"=>"text/plain"}, @status=404> (Excon::Errors::NotFound)
2012-06-22 11:09:17 -04:00
|
|
|
# Load centos
|
2012-06-22 11:26:11 -04:00
|
|
|
Fog::Compute[:serverlove].load_standard_image(@image['drive'], '88ed067f-d2b8-42ce-a25f-5297818a3b6f')
|
|
|
|
Fog::Compute[:serverlove].images.get(@image['drive']).imaging != "" # This will be "x%" when imaging
|
Added loading of standard image.
Currently not working:
Expected(204) <=> Actual(404 Not Found)
request => {:connect_timeout=>60, :headers=>{"Authorization"=>"Basic YWE4ZWIxYzktYzc4OC00MDlmLWJmZjQtYjAyMjVjMDE0MDQ1OkFkZ1hYSGVUTmY3TTJHR1l2NEI3WkpnWE1ISkJMY1E2dlJBejRZUUg=", "Accept"=>"application/json", "Host"=>"api.z1-man.serverlove.com:443", "Content-Length"=>0}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/seanhandley/.rvm/gems/ruby-1.9.3-p125@fog_gem/gems/excon-0.14.1/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"api.z1-man.serverlove.com", :path=>"/drives/aea15650-5001-4cb8-8146-8c9835f5b880/image/679f5f44-0be7-4745-a658-cccd4334c1aa", :port=>"443", :query=>nil, :scheme=>"https", :method=>"post", :expects=>204}
response => #<Excon::Response:0x007ff661811848 @body="Operation failed: drive not found\n", @headers={"Server"=>"BaseHTTP/0.3 Python/2.6.6", "Date"=>"Fri, 22 Jun 2012 15:03:50 GMT", "X-Elastic-Error"=>"missing drive", "Connection"=>"close", "Content-Type"=>"text/plain"}, @status=404> (Excon::Errors::NotFound)
2012-06-22 11:09:17 -04:00
|
|
|
end
|
|
|
|
|
2012-07-16 15:30:03 -04:00
|
|
|
tests("waits for imaging...").returns(true) do
|
|
|
|
while(percent_complete = Fog::Compute[:serverlove].images.get(@image['drive']).imaging)
|
|
|
|
sleep(1)
|
|
|
|
STDERR.print "#{percent_complete} "
|
|
|
|
break if percent_complete.include?("100")
|
|
|
|
end
|
|
|
|
STDERR.print "100% "
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2012-04-29 15:50:17 -04:00
|
|
|
tests("#destroy_image").succeeds do
|
|
|
|
Fog::Compute[:serverlove].destroy_image(@image['drive'])
|
|
|
|
end
|
2012-04-29 12:59:24 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|