2011-06-16 19:28:54 -04:00
|
|
|
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,
|
|
|
|
'drives' => {
|
2011-05-10 19:26:38 -04:00
|
|
|
'position' => Fog::Nullable::Integer,
|
2011-02-23 18:00:56 -05:00
|
|
|
'size' => Integer
|
|
|
|
},
|
|
|
|
'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
|
|
|
|
},
|
2011-05-26 17:36:42 -04:00
|
|
|
'position' => Fog::Nullable::Integer,
|
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?
|
2011-06-16 19:28:54 -04:00
|
|
|
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?
|
2011-06-16 19:28:54 -04:00
|
|
|
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?
|
2011-06-16 19:28:54 -04:00
|
|
|
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?
|
2011-06-16 19:28:54 -04:00
|
|
|
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?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:voxel].voxcloud_delete(@server_id)
|
2011-02-20 14:39:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
2011-06-16 19:28:54 -04:00
|
|
|
tests('#voxcloud_delete(0)').raises(Fog::Compute::Voxel::Error) do
|
2011-02-23 18:00:56 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:voxel].voxcloud_delete(0)
|
2011-02-20 14:39:37 -05:00
|
|
|
end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
tests('#voxcloud_status(0)').raises(Fog::Compute::Voxel::Error) do
|
2011-02-23 18:00:56 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:voxel].voxcloud_status(0)
|
2011-02-20 14:39:37 -05:00
|
|
|
end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
tests('#devices_list(0)').raises(Fog::Compute::Voxel::Error) do
|
2011-02-23 18:00:56 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:voxel].devices_list(0)
|
2011-02-20 14:39:37 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|