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

124 lines
3.3 KiB
Ruby
Raw Normal View History

Shindo.tests('Fog::Compute[:voxel] | server requests', ['voxel']) do
2011-02-20 14:39:37 -05:00
@server_format = {
2011-02-23 18:00:56 -05:00
'device' => {
'id' => String,
'last_update' => Time
2011-02-20 14:39:37 -05:00
},
2011-02-23 18:00:56 -05:00
'stat' => String
}
@devices_format = {
'devices' => [{
'access_methods' => [],
'description' => String,
2011-07-22 13:04:18 -04:00
'drives' => [{
'position' => Fog::Nullable::String,
2011-02-23 18:00:56 -05:00
'size' => Integer
2011-07-22 13:04:18 -04:00
}],
2011-02-23 18:00:56 -05:00
'id' => String,
'ipassignments' => [{
'description' => String,
'id' => String,
'type' => String,
'value' => String
}],
'label' => String,
'location' => {
'cage' => {
'id' => String,
'value' => String
},
'facility' => {
'code' => String,
'id' => String,
'value' => String
},
'position' => Fog::Nullable::String,
2011-02-23 18:00:56 -05:00
'rack' => {
'id' => String,
'value' => String
},
'row' => {
'id' => String,
'value' => String
},
'zone' => {
'id' => String,
'value' => String
}
},
'memory' => { 'size' => Integer },
'model' => {
'id' => String,
'value' => String
},
'operating_system' => {
'architecture' => Integer,
'name' => String
},
'power_consumption' => String,
'processor' => {
'cores' => Integer
},
'status' => String,
'type' => {
'id' => String,
'value' => String
},
2011-03-10 19:34:55 -05:00
}],
'stat' => String,
2011-02-20 14:39:37 -05:00
}
tests('success') do
2011-02-20 22:01:28 -05:00
@server_id = nil
2011-02-23 18:00:56 -05:00
@name = "fog.#{Time.now.to_i}"
2011-02-20 14:39:37 -05:00
2011-02-23 18:00:56 -05:00
tests("#voxcloud_create( :hostname => '#{@name}', :disk_size => 10, :processing_cores => 1, :image_id => 55, :facility => 'LDJ1' )").formats(@server_format) do
pending if Fog.mocking?
data = Fog::Compute[:voxel].voxcloud_create( :hostname => @name, :disk_size => 10, :processing_cores => 1, :image_id => 55, :facility => "LDJ1" ).body
2011-02-23 18:00:56 -05:00
@server_id = data['device']['id']
2011-02-20 14:39:37 -05:00
data
end
2011-02-23 18:00:56 -05:00
unless Fog.mocking?
Fog::Compute[:voxel].servers.get(@server_id).wait_for { ready? }
2011-02-23 18:00:56 -05:00
end
2011-02-20 14:39:37 -05:00
2011-02-23 18:00:56 -05:00
tests('#devices_list').formats(@devices_format) do
pending if Fog.mocking?
Fog::Compute[:voxel].devices_list.body
2011-02-20 14:39:37 -05:00
end
2011-02-23 18:00:56 -05:00
tests('#devices_list(@server_id)').formats(@devices_format) do
pending if Fog.mocking?
Fog::Compute[:voxel].devices_list(@server_id).body
2011-02-20 14:39:37 -05:00
end
tests("#voxcloud_delete(#{@server_id})").succeeds do
2011-02-23 18:00:56 -05:00
pending if Fog.mocking?
Fog::Compute[:voxel].voxcloud_delete(@server_id)
2011-02-20 14:39:37 -05:00
end
end
tests('failure') do
tests('#voxcloud_delete(0)').raises(Fog::Compute::Voxel::Error) do
2011-02-23 18:00:56 -05:00
pending if Fog.mocking?
Fog::Compute[:voxel].voxcloud_delete(0)
2011-02-20 14:39:37 -05:00
end
tests('#voxcloud_status(0)').raises(Fog::Compute::Voxel::Error) do
2011-02-23 18:00:56 -05:00
pending if Fog.mocking?
Fog::Compute[:voxel].voxcloud_status(0)
2011-02-20 14:39:37 -05:00
end
tests('#devices_list(0)').raises(Fog::Compute::Voxel::Error) do
2011-02-23 18:00:56 -05:00
pending if Fog.mocking?
Fog::Compute[:voxel].devices_list(0)
2011-02-20 14:39:37 -05:00
end
end
end