2010-09-09 20:50:38 -04:00
|
|
|
Shindo.tests('Slicehost::Compute | slice requests', ['slicehost']) do
|
2010-06-01 00:39:17 -04:00
|
|
|
|
|
|
|
@slice_format = {
|
|
|
|
'addresses' => [String],
|
|
|
|
'bw-in' => Float,
|
|
|
|
'bw-out' => Float,
|
|
|
|
'flavor-id' => Integer,
|
|
|
|
'id' => Integer,
|
|
|
|
'image-id' => Integer,
|
|
|
|
'name' => String,
|
|
|
|
'progress' => Integer,
|
|
|
|
'status' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
@slice_id = nil
|
|
|
|
|
|
|
|
tests("#create_slice(1, 19, 'fogcreateslice')").formats(@slice_format.merge('root-password' => String)) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
data = Slicehost[:compute].create_slice(1, 19, 'fogcreateslice').body
|
2010-06-01 00:39:17 -04:00
|
|
|
@slice_id = data['id']
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2010-10-13 20:54:14 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
Slicehost[:compute].servers.get(@slice_id).wait_for { ready? }
|
|
|
|
end
|
2010-06-01 00:39:17 -04:00
|
|
|
|
|
|
|
tests("#get_slice(#{@slice_id})").formats(@slice_format) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].get_slice(@slice_id).body
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_slices").formats({'slices' => [@slice_format]}) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].get_slices.body
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#reboot_slice(#{@slice_id})").formats(@slice_format) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].reboot_slice(@slice_id).body
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
2010-10-13 20:54:14 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
Slicehost[:compute].servers.get(@slice_id).wait_for { ready? }
|
|
|
|
end
|
2010-06-01 00:39:17 -04:00
|
|
|
|
|
|
|
tests("#delete_slice(#{@slice_id})").succeeds do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].delete_slice(@slice_id)
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests('#get_slice(0)').raises(Excon::Errors::Forbidden) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].get_slice(0)
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('#reboot_slice(0)').raises(Excon::Errors::Forbidden) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].reboot_slice(0)
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
2010-09-09 20:50:38 -04:00
|
|
|
tests('#delete_slice(0)').raises(Fog::Slicehost::Compute::NotFound) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2010-09-09 20:50:38 -04:00
|
|
|
Slicehost[:compute].delete_slice(0)
|
2010-06-01 00:39:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|